There are many ways to Pretty print XML in Python some of the important are as follows:-
dom = xml.dom.minidom.parse(xml_fname)
pretty_xml_as_string = dom.toprettyxml()
Another thing you can use that lxml has recently, updated, that includes a pretty print function. Below is the code for the same.
import lxml.etree as etree
x = etree.parse("filename")