doc = etree.XML(data, etree.XMLParser(remove_blank_text=True))
for parent in doc.xpath('//*[./*]'):
    parent[:] = sorted(parent, key=lambda x: x.tag)
print(etree.tostring(doc, pretty_print=True))
LXML - Sorting Tag Order