code: def download_file(url, path, session=None, params=None):
      
  
      if url[0:2] == '//':
          url = 'https://' + url[2:]
  
      # Use a temporary file so that we don't import incomplete files.
      tmp_path = path + '.tmp'
  
      if session and params:
          r = session.get( url, params=params, stream=True )
      elif session and not params:
          r = session.get( url, stream=True )
      else:
          r = requests.get(url, stream=True)
      with open(tmp_path, 'wb') as f:
          total_length = int(r.headers.get('content-length', 0))
          for chunk in progress.bar(r.iter_content(chunk_size=1024), expected_size=(total_length / 1024) + 1):
              if chunk:  # filter out keep-alive new chunks
                  f.write(chunk)
                  f.flush()
  
      os.rename(tmp_path, path)
  
      return path
docs: Download an individual file.