title: XML Declaration standalone="yes" lxml
body: <p>I have an xml I am parsing, making some changes and saving out to a new file. It has the declaration <code>&lt;?xml version="1.0" encoding="utf-8" standalone="yes"?&gt;</code> which I would like to keep. When I am saving out my new file I am loosing the <code>standalone="yes"</code> bit. How can I keep it in?
  Here is my code:</p>
  
  <pre><code>templateXml = """&lt;?xml version="1.0" encoding="utf-8" standalone="yes"?&gt;
  &lt;package&gt;
    &lt;provider&gt;Some Data&lt;/provider&gt;
    &lt;studio_display_name&gt;Some Other Data&lt;/studio_display_name&gt;
  &lt;/package&gt;"""
  
  from lxml import etree
  tree = etree.fromstring(templateXml)
  
  xmlFileOut = '/Users/User1/Desktop/Python/Done.xml'   
  
  with open(xmlFileOut, "w") as f:
      f.write(etree.tostring(tree, pretty_print = True, xml_declaration = True, encoding='UTF-8'))
  </code></pre>