':param tags: A tuple with the tag names to yield. Use None if you want
all tags to be returned.
:return: Yield tuples with (tag_name, tag_attrs, tag_text)
:see: https://github.com/andresriancho/w3af/issues/9990
:see: _parse_response_body_as_string for more/better docs'

def get_tags_by_filter(self, tags, yield_text=False):

    resp_body = self.get_http_response().body
    if (not resp_body):
        raise StopIteration
    body_io = StringIO.StringIO(resp_body.encode(DEFAULT_ENCODING))
    context = etree.iterparse(body_io, events=('start',), tag=tags, html=True, recover=True, encoding=DEFAULT_ENCODING, huge_tree=False)
    for (event, elem) in context:
        text = None
        if yield_text:
            text = elem.text
        (yield Tag(elem.tag, dict(elem.attrib), text))
        '\n                                                elem.clear()\n                                                while    elem.getprevious()    is    not    None:\n                                                                del    elem.getparent()[0]\n                                                '
    del context
