<Element html at 0x2ab9540>
data = """<html>
<head>
</head>
<body>Привет мир</body>
</html>"""
html = lxml.html.document_fromstring(data)
print (html)
>>> import lxml.html
>>> html = lxml.html.fromstring('''\
... <html><body onload="" color="white">
... <p>Hi !</p>
... </body></html>
... ''')
>>> print lxml.html.tostring(html)
<html><body onload="" color="white"><p>Hi !</p></body></html>
>>> print lxml.html.tostring(html)
<html> <body color="white" onload=""> <p>Hi !</p> </body> </html>
>>> print lxml.html.tostring(html)
<html>
<body color="white" onload="">
<p>Hi !</p>
</body>
</html>