Does anyone know of a memory efficient way to generate very large xml files (e.g. 100-500 MiB) in Python? 
I've been utilizing lxml, but memory usage is through the roof.
The only sane way to generate so large an XML file is line by line, which means printing while running a state machine, and lots of testing.
Generating very large XML files in Python?