code: def queryHTML(self, path):
          
          if etree is None:
              raise Exception("lxml not available")
          document = etree.HTML(self.contents)
          for node in document.xpath(path):
              if isinstance(node, basestring):
                  print node
              else:
                  print etree.tostring(node, pretty_print=True).strip()
docs: Run an XPath query on the HTML document and print matches.