code: def load_legacy_features_and_labels(
      meta_graph_def: tf.compat.v1.MetaGraphDef, graph: tf.Graph
  ) -> Tuple[Dict[str, types.TensorType], Dict[str, types.TensorType]]:
      """Loads legacy features and labels nodes.
  
      Args:
        meta_graph_def: MetaGraphDef to lookup nodes in.
        graph: TensorFlow graph to lookup the nodes in.
  
      Returns:
        Tuple of (features_map, labels_map)
      """
      encoded_features_map = collections.OrderedDict(
          get_node_map_in_graph(
              meta_graph_def,
              encoding.FEATURES_COLLECTION,
              [encoding.NODE_SUFFIX],
              graph,
          )
      )
      features_map = collections.OrderedDict()
      for key in encoded_features_map:
          features_map[key] = encoded_features_map[key][
              encoding.NODE_SUFFIX
          ]
  
      encoded_labels_map = collections.OrderedDict(
          get_node_map_in_graph(
              meta_graph_def,
              encoding.LABELS_COLLECTION,
              [encoding.NODE_SUFFIX],
              graph,
          )
      )
      labels_map = collections.OrderedDict()
      for key in encoded_labels_map:
          labels_map[key] = encoded_labels_map[key][
              encoding.NODE_SUFFIX
          ]
  
      # Assume that KeyType is only Text
      # pytype: disable=bad-return-type
      return (features_map, labels_map)
  
imports: import collections
  from typing import Dict, List, Optional, Tuple, Union
  import tensorflow
  from tensorflow_model_analysis.api import types
  from tensorflow_model_analysis.eval_saved_model import constants
  from tensorflow_model_analysis.eval_saved_model import encoding
  from tensorflow_model_analysis.eval_saved_model import util
  from google.protobuf import any_pb2
  from tensorflow.core.protobuf import meta_graph_pb2
label_desc: Use image node_id 3 for calling a global function with example usage: load_legacy_features_and_labels(meta_graph_def, graph) and returns: features_map,  labels_map