doc = etree.ElementTree(page)
pageElement = etree.SubElement(page, 'Country', name='Germany', Code='DE',
    Storage='Basic')
outFile = open('output.xml', 'w')
doc.write(outFile, xml_declaration=True, encoding='utf-16')
Generating xml in python and lxml