code: def download_file(url, data_path='.', filename=None, size=None, chunk_size=4096, verbose=True):
      
      if filename is None:
          filename = dropbox_basename(url)
      file_path = os.path.join(data_path, filename)
      if url.endswith('?dl=0'):
          url = url[:-1] + '1'  # noninteractive download
      if verbose:
          tqdm_prog = tqdm
          print('requesting URL: {}'.format(url))
      else:
          tqdm_prog = no_tqdm
      r = requests.get(url, stream=True, allow_redirects=True, timeout=5)
      size = r.headers.get('Content-Length', None) if size is None else size
      print('remote size: {}'.format(size))
  
      stat = path_status(file_path)
      print('local size: {}'.format(stat.get('size', None)))
      if stat['type'] == 'file' and stat['size'] == size:  # TODO: check md5 or get the right size of remote file
          r.close()
          return file_path
  
      print('Downloading to {}'.format(file_path))
  
      with open(file_path, 'wb') as f:
          for chunk in r.iter_content(chunk_size=chunk_size):
              if chunk:  # filter out keep-alive chunks
                  f.write(chunk)
  
      r.close()
      return file_path
docs: Uses stream=True and a reasonable chunk size to be able to download large (GB) files over https