from html5lib import HTMLParser, treebuilders
parser = HTMLParser(tree=treebuilders.getTreeBuilder('beautifulsoup'))
text = 'a<b>b<b>c'
soup = parser.parse(text)
print(soup.prettify())
Веб-скрапинг с помощью Python