def build_response(self, req, resp):
response = Response()<EOL>response.status_code = getattr(resp, '<STR_LIT:status>', None)<EOL>response.headers = CaseInsensitiveDict(getattr(resp, '<STR_LIT>', {}))<EOL>response.encoding = get_encoding_from_headers(response.headers)<EOL>response.raw = resp<EOL>response.reason = response.raw.reason<EOL>if isinstance(req.url, bytes):<EOL><INDENT>response.url = req.url.decode('<STR_LIT:utf-8>')<EOL><DEDENT>else:<EOL><INDENT>response.url = req.url<EOL><DEDENT>extract_cookies_to_jar(response.cookies, req, resp)<EOL>response.request = req<EOL>response.connection = self<EOL>return response<EOL>
Builds a :class:`Response <requests.Response>` object from a urllib3
        response. This should not be called from user code, and is only exposed
        for use when subclassing the
        :class:`HTTPAdapter <requests.adapters.HTTPAdapter>`

        :param req: The :class:`PreparedRequest <PreparedRequest>` used to generate the response.
        :param resp: The urllib3 response object.
        :rtype: requests.Response