'This method mangles the response.
:param response: This is the response to mangle.
:return: A mangled version of the response.'

def mangle_response(self, response):

    body = response.get_body()
    for (regex, string) in self._manglers['s']['b']:
        body = regex.sub(string, body)
    response.set_body(body)
    header_string = str(response.get_headers())
    for (regex, string) in self._manglers['s']['h']:
        header_string = regex.sub(string, header_string)
    try:
        mangled_header = Headers.from_string(header_string)
    except ValueError:
        error = 'Your    header    modifications    created    an    invalid    header    string    that    could    NOT    be    parsed    back    to    a    Header    object.'
        om.out.error(error)
    else:
        response.set_headers(mangled_header)
    if self._user_option_fix_content_len:
        response = self._fix_content_len(response)
    return response
