root = etree.XML('<root><a><b/></a></root>')
etree.tostring(root)
print(etree.tostring(root, xml_declaration=True))
print(etree.tostring(root, encoding='iso-8859-1'))
How can I view a text representation of an lxml element?