code: def _extract_archive(file, target_dir):
      
      if file.endswith('.gz') or file.endswith('.tar') or file.endswith('.tgz'):
          archive = tarfile.open(file, 'r')
      elif file.endswith('.zip'):
          archive = zipfile.ZipFile(file, 'r')
      else:
          raise Exception('Unrecognized file type: ' + file)
      archive.extractall(path=target_dir)
      archive.close()
docs: Extract archive file
  
      Parameters
      ----------
      file : str
          Absolute path of the archive file.
      target_dir : str
          Target directory of the archive to be uncompressed