code: def _download_file(url, savepath, print_progress):
      if print_progress:
          print("Connecting to {}".format(url))
      r = requests.get(url, stream=True, timeout=15)
      total_length = r.headers.get("content-length")
  
      if total_length is None:
          with open(savepath, "wb") as f:
              shutil.copyfileobj(r.raw, f)
      else:
          with open(savepath, "wb") as f:
              dl = 0
              total_length = int(total_length)
              starttime = time.time()
              if print_progress:
                  print("Downloading %s" % os.path.basename(savepath))
              for data in r.iter_content(chunk_size=4096):
                  dl += len(data)
                  f.write(data)
                  if print_progress:
                      done = int(50 * dl / total_length)
                      progress(
                          "[%-50s] %.2f%%"
                          % ("=" * done, float(100 * dl) / total_length)
                      )
          if print_progress:
              progress("[%-50s] %.2f%%" % ("=" * 50, 100), end=True)
  
file_path: PaddleSeg/contrib/MedicalSeg/medicalseg/utils/download.py
imports: import functools
  import os
  import shutil
  import sys
  import tarfile
  import time
  import zipfile
  import requests
label_desc: Use image node_id 2 for calling a global function with example usage: _download_file(url, savepath, print_progress) without return types