code: def unpack(
      input_archive: Union[Path, str],
      outpath: Union[Path, str],
      use_cache: bool = True,
  ) -> Dict[str, str]:
      """Scan all files in the archive file and return as a dict of files.
  
      Examples:
          tarfile:
             model.pth
             some1.file
             some2.file
  
          >>> unpack("tarfile", "out")
          {'asr_model_file': 'out/model.pth'}
      """
      input_archive = Path(input_archive)
      outpath = Path(outpath)
  
      with Archiver(input_archive) as archive:
          for info in archive:
              if (
                  Path(archive.get_name_from_info(info)).name
                  == "meta.yaml"
              ):
                  if (
                      use_cache
                      and (
                          outpath
                          / Path(archive.get_name_from_info(info))
                      ).exists()
                  ):
                      retval = get_dict_from_cache(
                          outpath
                          / Path(archive.get_name_from_info(info))
                      )
                      if retval is not None:
                          return retval
                  d = yaml.safe_load(archive.extractfile(info))
                  assert isinstance(d, dict), type(d)
                  yaml_files = d["yaml_files"]
                  files = d["files"]
                  assert isinstance(yaml_files, dict), type(yaml_files)
                  assert isinstance(files, dict), type(files)
                  break
          else:
              raise RuntimeError("Format error: not found meta.yaml")
  
          for info in archive:
              fname = archive.get_name_from_info(info)
              outname = outpath / fname
              outname.parent.mkdir(parents=True, exist_ok=True)
              if fname in set(yaml_files.values()):
                  d = yaml.safe_load(archive.extractfile(info))
                  # Rewrite yaml
                  for info2 in archive:
                      name = archive.get_name_from_info(info2)
                      d = find_path_and_change_it_recursive(
                          d, name, str(outpath / name)
                      )
                  with outname.open("w", encoding="utf-8") as f:
                      yaml.safe_dump(d, f)
              else:
                  archive.extract(info, path=outpath)
  
          retval = {}
          for key, value in list(yaml_files.items()) + list(
              files.items()
          ):
              retval[key] = str(outpath / value)
          return retval
  
imports: import os
  import sys
  import tarfile
  import zipfile
  from datetime import datetime
  from io import BytesIO, TextIOWrapper
  from pathlib import Path
  from typing import Dict, Iterable, Optional, Union
  import yaml
label_desc: Use image node_id 3 for calling a global function with example usage: unpack(input_archive, outpath, use_cache) and returns: retval, retval