code: def iter_tar(arch_f, stream=False):
      """Iter over tar archive, yielding (path, object-like) tuples.
  
      Args:
        arch_f: File object of the archive to iterate.
        stream: If True, open the archive in stream mode which allows for faster
          processing and less temporary disk consumption, but random access to the
          file is not allowed.
  
      Yields:
        (filepath, extracted_fobj) for each file in the archive.
      """
      read_type = "r" + ("|" if stream else ":") + "*"
  
      with _open_or_pass(arch_f) as fobj:
          tar = tarfile.open(mode=read_type, fileobj=fobj)
          for member in tar:
              if stream and (member.islnk() or member.issym()):
                  # Links cannot be dereferenced in stream mode.
                  logging.warning(
                      "Skipping link during extraction: %s", member.name
                  )
                  continue
  
              try:
                  extract_file = tar.extractfile(member)
              except KeyError:
                  if not (member.islnk() or member.issym()):
                      raise  # Forward exception non-link files which couldn't be extracted
                  # The link could not be extracted, which likely indicates a corrupted
                  # archive.
                  logging.warning(
                      "Skipping extraction of invalid link: %s -> %s",
                      member.name,
                      member.linkname,
                  )
                  continue
  
              if extract_file:  # File with data (not directory):
                  path = _normpath(
                      member.path
                  )  # pytype: disable=attribute-error
                  if not path:
                      continue
                  yield (path, extract_file)
  
imports: import bz2
  import concurrent.futures
  import contextlib
  import gzip
  import multiprocessing
  import os
  import tarfile
  import typing
  from typing import Iterator, Tuple, Union
  import uuid
  import zipfile
  from absl import logging
  from etils import epath
  import promise
  from tensorflow_datasets.core import constants
  from tensorflow_datasets.core import utils
  from tensorflow_datasets.core.download import resource
  from tensorflow_datasets.core.utils import file_utils
  from tensorflow_datasets.core.utils.lazy_imports_utils import tensorflow
label_desc: Use image node_id 5 for calling a global function with example usage: iter_tar(arch_f, stream) without return types