'Receives a Response. Returns a generator of Responses.'

def resolve_redirects(self, resp, req, stream=False, timeout=None, verify=True, cert=None, proxies=None, **adapter_kwargs):

    i = 0
    hist = []
    while resp.is_redirect:
        prepared_request = req.copy()
        if (i > 0):
            hist.append(resp)
            new_hist = list(hist)
            resp.history = new_hist
        try:
            resp.content
        except (ChunkedEncodingError, ContentDecodingError, RuntimeError):
            resp.raw.read(decode_content=False)
        if (i >= self.max_redirects):
            raise TooManyRedirects(('Exceeded    %s    redirects.' % self.max_redirects))
        resp.close()
        url = resp.headers['location']
        method = req.method
        if url.startswith('//'):
            parsed_rurl = urlparse(resp.url)
            url = ('%s:%s' % (parsed_rurl.scheme, url))
        parsed = urlparse(url)
        url = parsed.geturl()
        if (not parsed.netloc):
            url = urljoin(resp.url, requote_uri(url))
        else:
            url = requote_uri(url)
        prepared_request.url = to_native_string(url)
        if (resp.is_permanent_redirect and (req.url != prepared_request.url)):
            self.redirect_cache[req.url] = prepared_request.url
        if ((resp.status_code == codes.see_other) and (method != 'HEAD')):
            method = 'GET'
        if ((resp.status_code == codes.found) and (method != 'HEAD')):
            method = 'GET'
        if ((resp.status_code == codes.moved) and (method == 'POST')):
            method = 'GET'
        prepared_request.method = method
        if (resp.status_code not in (codes.temporary_redirect, codes.permanent_redirect)):
            if ('Content-Length' in prepared_request.headers):
                del prepared_request.headers['Content-Length']
            prepared_request.body = None
        headers = prepared_request.headers
        try:
            del headers['Cookie']
        except KeyError:
            pass
        extract_cookies_to_jar(prepared_request._cookies, req, resp.raw)
        prepared_request._cookies.update(self.cookies)
        prepared_request.prepare_cookies(prepared_request._cookies)
        proxies = self.rebuild_proxies(prepared_request, proxies)
        self.rebuild_auth(prepared_request, resp)
        req = prepared_request
        resp = self.send(req, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, allow_redirects=False, **adapter_kwargs)
        extract_cookies_to_jar(self.cookies, prepared_request, resp.raw)
        i += 1
        (yield resp)
