tree.write('createxml.xml',xml_declaration=True, encoding='utf-8', method="xml")
root = ET.Element('bookstore')
tree = ET.ElementTree()
tree._setroot(root)
child0 = ET.Element('book',{'category':"COOKING"})
root.append(child0)
child00 = ET.Element('title',{'language':"English"})
child00.text='Everyday Italian'
child0.append(child00)
tree.write('createxml.xml','utf-8')