I have an xml I am parsing, making some changes and saving out to a new file. It has the declaration
You can pass standalone keyword argument to tostring():
standalone
tostring()
etree.tostring(tree, pretty_print = True, xml_declaration = True, encoding='UTF-8', standalone=True)