Hey! I know this is an old thread, but I was looking for this too, until I decided to give it a try with claude. I kind of did it, and it works most of the time, but maybe there is a better way. Also I included a script to get rid of empty nulls and nulls with just one child.