'Create a parse tree from the given HTML.'

def __init__(self, html):

    def really_parse_fragment(parser, html):
        "Parse    a    possibly    multi-rooted    HTML    fragment,    wrapping    it    in    a\n                                                <div>    to    make    it    easy    to    query    later.\n\n                                                As    far    as    I    can    tell,    this    is    what    parseFragment    is    supposed    to    do\n                                                (but    doesn't).    See\n                                                http://code.google.com/p/html5lib/issues/detail?id=161.\n\n                                                "
        top_level_elements = parser.parseFragment(html)
        container = Element(self.CONTAINER_TAG)
        if (top_level_elements and isinstance(top_level_elements[0], basestring)):
            container.text = top_level_elements.pop(0)
        container.extend(top_level_elements)
        return container
    p = HTMLParser(tree=getTreeBuilder(self.TREEBUILDER))
    self._root = really_parse_fragment(p, html)
