code: def _AugmentExtracts(
      data: Dict[str, Any],
      prefix: str,
      excludes: List[bytes],
      extracts: types.Extracts,
  ) -> None:
      """Augments the Extracts with FeaturesPredictionsLabels.
  
      Args:
        data: Data dictionary returned by PredictExtractor.
        prefix: Prefix to use in column naming (e.g. 'features', 'labels', etc).
        excludes: List of strings containing features, predictions, or labels to
          exclude from materialization.
        extracts: The Extracts to be augmented. This is mutated in-place.
  
      Raises:
        TypeError: If the FeaturesPredictionsLabels is corrupt.
      """
      for name, val in data.items():
          if excludes is not None and name in excludes:
              continue
          # If data originated from FeaturesPredictionsLabels, then the value will be
          # stored under a 'node' key.
          if isinstance(val, dict) and encoding.NODE_SUFFIX in val:
              val = val.get(encoding.NODE_SUFFIX)
  
          if name in (prefix, util.KEY_SEPARATOR + prefix):
              col_name = prefix
          elif prefix not in ("features", "predictions", "labels"):
              # Names used by additional extracts should be properly escaped already so
              # avoid escaping the name a second time by manually combining the prefix.
              col_name = prefix + util.KEY_SEPARATOR + name
          else:
              col_name = util.compound_key([prefix, name])
  
          if isinstance(val, tf.compat.v1.SparseTensorValue):
              extracts[col_name] = types.MaterializedColumn(
                  name=col_name, value=val.values
              )
  
          elif isinstance(val, np.ndarray) or isinstance(val, list):
              # Only support first dim for now
              val = (
                  val[0] if len(val) > 0 else []
              )  # pylint: disable=g-explicit-length-test
              extracts[col_name] = types.MaterializedColumn(
                  name=col_name, value=val
              )
  
          else:
              raise TypeError(
                  "Dictionary item with key %s, value %s had unexpected type %s"
                  % (name, val, type(val))
              )
  
file_path: model-analysis/tensorflow_model_analysis/extractors/legacy_feature_extractor.py
imports: import copy
  from typing import Any, Dict, List, Optional
  from absl import logging
  import apache_beam
  import numpy
  import tensorflow
  from tensorflow_model_analysis import constants
  from tensorflow_model_analysis.api import types
  from tensorflow_model_analysis.eval_saved_model import encoding
  from tensorflow_model_analysis.extractors import extractor
  from tensorflow_model_analysis.utils import util
label_desc: Use image node_id 2 for calling a global function with example usage: _AugmentExtracts(data, prefix, excludes, extracts) without return types