code: def extract_tensor_maybe_dict(
      prefix: str, dict_of_tensors: types.DictOfTensorType
  ) -> types.TensorTypeMaybeDict:
      """Returns tensor if single entry under default key else returns dict."""
      default_key = default_dict_key(prefix)
      if list(dict_of_tensors) == [default_key]:
          return dict_of_tensors[default_key]
      return dict_of_tensors
  
file_path: model-analysis/tensorflow_model_analysis/eval_saved_model/util.py
imports: from typing import Any, Callable, List, Optional, Tuple
  import numpy
  import tensorflow
  from tensorflow import estimator
  from tensorflow_model_analysis.api import types
  from tensorflow_model_analysis.utils import util
  from tensorflow.core.example import example_pb2
label_desc: Use image node_id 2 for calling a global function with example usage: extract_tensor_maybe_dict(prefix, dict_of_tensors) and returns: dict_of_tensors, dict_of_tensors