code: def _read_archive(archive_path, selection):
      """Yields non-processed examples out of archive."""
      example = {}
      read_band_files = 0
      for fpath, fobj in tfds.core.download.extractor.iter_tar_stream(
          archive_path
      ):
          read_band_files += 1
          _, patch_name, fname = fpath.split(os.path.sep)
          if fname.endswith("_labels_metadata.json"):
              example["metadata"] = fobj.read()
          elif fname.endswith(".tif"):
              band = fname[-7:-4]
              if selection != "rgb" or (
                  selection == "rgb" and band in {"B02", "B03", "B04"}
              ):
                  example[band] = fobj.read()
                  example.setdefault("bands", []).append(band)
          else:
              raise AssertionError("Unexpected file: %s" % fpath)
          if read_band_files == 13:
              example["filename"] = patch_name
              yield example
              example = {}
              read_band_files = 0
  
file_path: datasets/tensorflow_datasets/datasets/bigearthnet/bigearthnet_dataset_builder.py
imports: from __future__ import annotations
  import io
  import json
  import os
  import numpy
  import tensorflow_datasets.public_api
label_desc: Use image node_id 1 for calling a global function with example usage: _read_archive(archive_path, selection) without return types