code: def download_file_and_uncompress(
      url,
      savepath=None,
      extrapath=None,
      extraname=None,
      print_progress=True,
      cover=False,
      delete_file=True,
      filename=None,
  ):
      if savepath is None:
          savepath = "."
  
      if extrapath is None:
          extrapath = "."
  
      savename = url.split("/")[-1]
      if not os.path.exists(savepath):
          os.makedirs(savepath)
  
      savepath = os.path.join(savepath, savename)
      savename = ".".join(savename.split(".")[:-1])
      savename = os.path.join(extrapath, savename)
      extraname = (
          savename
          if extraname is None
          else os.path.join(extrapath, extraname)
      )
  
      if cover:
          if os.path.exists(savepath):
              shutil.rmtree(savepath)
          if os.path.exists(savename):
              shutil.rmtree(savename)
          if os.path.exists(extraname):
              shutil.rmtree(extraname)
      full_path = (
          os.path.join(extraname, filename)
          if filename is not None
          else extraname
      )
  
      rank_id_curr_node = int(os.environ.get("PADDLE_RANK_IN_NODE", 0))
  
      if not os.path.exists(
          full_path
      ):  # If pretrained model exists, skip download process.
          lock_path = extraname + ".download.lock"
          with open(lock_path, "w"):  # touch
              os.utime(lock_path, None)
          if rank_id_curr_node == 0:
              if not os.path.exists(savename):
                  if not os.path.exists(savepath):
                      _download_file(url, savepath, print_progress)
  
                  if (not tarfile.is_tarfile(savepath)) and (
                      not zipfile.is_zipfile(savepath)
                  ):
                      if not os.path.exists(extraname):
                          os.makedirs(extraname)
                      shutil.move(savepath, extraname)
  
                  else:
                      savename = _uncompress_file(
                          savepath,
                          extrapath,
                          delete_file,
                          print_progress,
                      )
                      savename = os.path.join(extrapath, savename)
                      shutil.move(savename, extraname)
  
              os.remove(lock_path)
  
          else:
              while os.path.exists(lock_path):
                  time.sleep(0.5)
  
      return extraname
  
file_path: PaddleSeg/paddleseg/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 6 for calling a global function with example usage: download_file_and_uncompress(url, savepath, extrapath, extraname, print_progress, cover, delete_file, filename) and returns: extraname