def choose_form_by_element(self, xpath):
        elem = self.select(xpath).node()
        while elem is not None:
            if elem.tag == 'form':
                self._lxml_form = elem
                return
            else:
                elem = elem.getparent()
        self._lxml_form = None
dataset/ETHPy150Open lorien/grab/grab/document.py/FormExtension.choose_form_by_element/original