'Receives a Response. Returns a redirect URI or ``None``'

def get_redirect_target(self, resp):

    if resp.is_redirect:
        location = resp.headers['location']
        if is_py3:
            location = location.encode('latin1')
        return to_native_string(location, 'utf8')
    return None
