'Parse the HTTP response body'

def _parse_response_body_as_string(self, resp_body, errors='strict'):

    if (not resp_body):
        return
    resp_body = resp_body.encode(DEFAULT_ENCODING, errors=errors)
    body_io = StringIO.StringIO(resp_body)
    event_map = {'start': self.start, 'end': self.end, 'comment': self.comment}
    context = etree.iterparse(body_io, events=event_map.keys(), tag=self.PARSE_TAGS, html=True, recover=True, encoding=DEFAULT_ENCODING, huge_tree=False)
    for (event, elem) in context:
        try:
            event_map[event](elem)
        except Exception as e:
            msg = 'Found    a    parser    exception    while    handling    tag    "%s"    with    event    "%s".    The    exception    was:    "%s"'
            args = (elem.tag, event, e)
            raise ParserException((msg % args))
        "\n                                                elem.clear()\n                                                while    elem.getprevious()    is    not    None:\n                                                                try:\n                                                                                del    elem.getparent()[0]\n                                                                except    TypeError:\n                                                                                #    TypeError:    'NoneType'    object    does    not    support    item    deletion\n                                                                                #    Happens    when    elem.getparent()    returns    None\n                                                                                pass\n                                                "
    del context
    self.close()
