

def _build_dom(self, content, mode):
    assert (content in ('html', 'xml'))
    if (mode == 'html'):
        if (not hasattr(THREAD_STORAGE, 'html_parser')):
            THREAD_STORAGE.html_parser = HTMLParser()
        dom = parse(StringIO(content), parser=THREAD_STORAGE.html_parser)
        return dom.getroot()
    else:
        if (not hasattr(THREAD_STORAGE, 'xml_parser')):
            THREAD_STORAGE.xml_parser = XMLParser()
        dom = parse(BytesIO(content), parser=THREAD_STORAGE.xml_parser)
        return dom.getroot()

dataset/ETHPy150Open lorien/grab/grab/document.py DomTreeExtension._build_dom/VarMisuse@16/19 `mode`->`content`