code: def _unpack_nemo_file(
      path2file: str, out_folder: str, extract_config_only: bool = False
  ) -> str:
      if not os.path.exists(path2file):
          raise FileNotFoundError(f"{path2file} does not exist")
  
      # we start with an assumption of uncompressed tar,
      # which should be true for versions 1.7.0 and above
      tar_header = "r:"
      try:
          tar_test = tarfile.open(path2file, tar_header)
          tar_test.close()
      except tarfile.ReadError:
          # can be older checkpoint => try compressed tar
          tar_header = "r:gz"
      tar = tarfile.open(path2file, tar_header)
      if not extract_config_only:
          tar.extractall(path=out_folder)
      else:
          members = [x for x in tar.getmembers() if ".yaml" in x.name]
          tar.extractall(path=out_folder, members=members)
      tar.close()
      return out_folder
  
imports: from __future__ import annotations
  import os
  import shutil
  import tarfile
  import tempfile
  import uuid
  from typing import Optional, Set, Union
  import torch
  from omegaconf import DictConfig, OmegaConf
  from omegaconf.omegaconf import open_dict
  from pytorch_lightning.trainer.trainer import Trainer
  from nemo.core import classes
  from nemo.utils import logging, model_utils
  from nemo.utils.app_state import AppState
  from nemo.utils.get_rank import is_global_rank_zero
  from nemo.utils.model_utils import inject_model_parallel_rank
label_desc: Use image node_id 14 for calling the SaveRestoreConnector obj's underlying member method code with example usage: obj._unpack_nemo_file(path2file, out_folder, extract_config_only) and returns: out_folder