<s>[INST] Pretty printing XML in Python What is the best way (or even the various ways) to pretty print xml in Python?
 [/INST] import xml.dom.minidom

xml = xml.dom.minidom.parse(xml_fname) # or xml.dom.minidom.parseString(xml_string)
pretty_xml_as_string = xml.toprettyxml()

 </s>