var parser = new DOMParser(); var htmlDoc = parser.parseFromString(txt, 'text/html'); htmlDoc.getElementById("someID");
soup = BeautifulSoup(s, "html.parser")