code: def download_file(url, filename):
      
      r = _get_requests_session().get(url, stream=True)
      if not r.ok:
          raise IOError("Unable to download file")
  
      with open(filename, "wb") as f:
          f.write(r.content)
docs: Downloads file from url to a path with filename