code: def final_bounces(fetches, url):
      
      redirects = {}
      for fetch in fetches:
           # XXX check http status 301,302,303,307? check for "uri" header
           # as well as "location"? see urllib.request.HTTPRedirectHandler
           if 'location' in fetch['response_headers']:
               redirects[fetch['url']] = fetch
  
      final_url = url
      while final_url in redirects:
          fetch = redirects.pop(final_url)
          final_url = urllib.parse.urljoin(
                  fetch['url'], fetch['response_headers']['location'])
  
      final_bounces = []
      for fetch in fetches:
          if fetch['url'] == final_url:
              final_bounces.append(fetch)
  
      return final_bounces
docs: Resolves redirect chains in `fetches` and returns a list of fetches
      representing the final redirect destinations of the given url. There could
      be more than one if for example youtube-dl hit the same url with HEAD and
      then GET requests.