code: def _get_saveable_from_factory(
      saveable_factories, serialized_tensor, created_compat_names
  ):
      """Returns the saveable generated from the factory method."""
      matched_factory = None
  
      # The `expected_factory_name` is used to find the right saveable factory,
      # while the `factory_input_name` is the value that is passed to the factory
      # method to instantiate the SaveableObject.
      expected_factory_name = serialized_tensor.name
      factory_input_name = serialized_tensor.checkpoint_key
  
      # Case 1: the name already exactly matches a key in saveable_factories.
      if expected_factory_name in saveable_factories:
          matched_factory = saveable_factories[expected_factory_name]
  
      # Case 2: (Forward compat) The serialized name is composed of
      # "factory_name" + "SUFFIX". Get the matching factory name.
      if matched_factory is None:
          for factory_name, factory in saveable_factories.items():
              if expected_factory_name.startswith(factory_name):
                  if matched_factory is not None:
                      # This condition is met in the extreme edge case where the object
                      # returns two saveable factories with similar names. This is very
                      # unlikely because there zero objects inside TensorFlow that use
                      # more than one saveable factory.
                      raise ValueError(
                          "Forward compatibility load error: Unable to load "
                          "checkpoint saved in future version of TensorFlow. "
                          "Please update your version of TensorFlow to the "
                          "version in which the checkpoint was saved."
                      )
  
                  matched_factory = factory
                  factory_input_name = (
                      _extract_saveable_name(
                          serialized_tensor.checkpoint_key
                      )
                      + factory_name
                  )
                  created_compat_names.add(factory_name)
  
      if callable(matched_factory):
          return matched_factory(name=factory_input_name)
      return matched_factory
  
imports: import collections
  from tensorflow.python.checkpoint import checkpoint_view
  from tensorflow.python.checkpoint import functional_saver
  from tensorflow.python.checkpoint import save_util_v1
  from tensorflow.python.checkpoint import saveable_compat
  from tensorflow.python.eager import context
  from tensorflow.python.framework import ops
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import gen_io_ops
  from tensorflow.python.ops import io_ops
  from tensorflow.python.platform import tf_logging
  from tensorflow.python.saved_model import registration
  from tensorflow.python.trackable import base
  from tensorflow.python.trackable import constants
  from tensorflow.python.trackable import python_state
  from tensorflow.python.trackable import trackable_utils
  from tensorflow.python.training.saving import saveable_object_util
  from tensorflow.python.util import object_identity
label_desc: Use image node_id 5 for calling a global function with example usage: _get_saveable_from_factory(saveable_factories, serialized_tensor, created_compat_names) and returns: matched_factory, matched_factory