My question is a follow up to How to parse restructuredtext in python? where @mbdevpl provided code for parsing the file into a tree and doing some processing on the tree.
I want to autoformat Python code in RST files. Now that I've discovered the code blocks in the tree and changed their contents, how do I write the changes back over the original file? Right now I'm doing this with regexes.