We used this in a project many suns ago and we ended up switching to libxml2, less pretty presentation, but more functional. YMMV.
For these cases it can be useful to do the reverse, and use the BeautifulSoup HTML parser as an alternative parser backend for the lxml package: https://lxml.de/elementsoup.html