code: def _filter_dom(dom, filters, last_find_all=False):
          
          if isinstance(dom, string_types):
              dom = BeautifulSoup(dom, 'html.parser')
          for idx, find in enumerate(filters, start=1):
              if not dom:
                  break
              name, attrs = find.get('name'), find.get('attrs', {})
              if len(filters) == idx and last_find_all:
                  dom = dom.find_all(name, attrs=attrs) if name else dom.find_all(attrs=attrs)
              else:
                  dom = dom.find(name, attrs=attrs) if name else dom.find(attrs=attrs)
          return dom
docs: If not exists, creates an DOM from a given session response, then filters the DOM
          via given API filters and returns the filtered DOM. The DOM is empty if the filters
          have no match.