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

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

    i = 0
    prepared_request = PreparedRequest()
    prepared_request.body = req.body
    prepared_request.headers = req.headers.copy()
    prepared_request.hooks = req.hooks
    prepared_request.method = req.method
    prepared_request.url = req.url
    while (('location' in resp.headers) and (resp.status_code in REDIRECT_STATI)):
        resp.content
        if (i >= self.max_redirects):
            raise TooManyRedirects(('Exceeded    %s    redirects.' % self.max_redirects))
        resp.close()
        url = resp.headers['location']
        method = prepared_request.method
        if url.startswith('//'):
            parsed_rurl = urlparse(resp.url)
            url = ('%s:%s' % (parsed_rurl.scheme, url))
        if (not urlparse(url).netloc):
            url = urljoin(resp.url, requote_uri(url))
        prepared_request.url = url
        if ((resp.status_code == codes.see_other) and (prepared_request.method != 'HEAD')):
            method = 'GET'
        if ((resp.status_code in (codes.moved, codes.found)) and (prepared_request.method == 'POST')):
            method = 'GET'
        prepared_request.method = method
        if (resp.status_code not in (codes.temporary, codes.resume)):
            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
        prepared_request.prepare_cookies(self.cookies)
        resp = self.send(prepared_request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, allow_redirects=False)
        extract_cookies_to_jar(self.cookies, prepared_request, resp.raw)
        i += 1
        (yield resp)
