After reading from an existing file with \'ugly\' XML and doing some modifications, pretty printing doesn\'t work. I\'ve tried etree.write(FILE_NAME, pretty_print=True
I am not sure why other answers did not mention this. If you want to obtain the root of the xml there is a method called getroot(). I hope I answered your question (though a little late).