using beautifulsoup with html5lib, it puts the html, head and body tags automatically:
BeautifulSoup(\'FOO\', \'html5lib\') # => <
Here is how I do it
a = BeautifulSoup() a.append(a.new_tag('section')) #this will give you