Was making a parser recently with BeautifulSoup. Came to the final with rendering contents of the edited text. Like so:
It renders those contents with a result wrapped into the <html>, <head> and <body> tags. So print output looks like so:
That's a feature of the html5lib library, it fixes HTML that is lacking, such as adding back in missing required elements.
The workaround is simple enough:
This solution will return an inside of the <html> tag <body>.