code: def _get_and_write_registered_savers(
      registered_trackables: Dict[str, List[_TrackableData]],
      object_graph_proto: trackable_object_graph_pb2.TrackableObjectGraph,
  ) -> Dict[str, Dict[str, base.Trackable]]:
      """Generates dictionary of registered savers and updates the proto."""
      registered_savers = collections.defaultdict(dict)
      for saver_name, trackables in registered_trackables.items():
          for td in trackables:
              registered_savers[saver_name][
                  td.object_name
              ] = td.object_to_save
  
              object_proto = object_graph_proto.nodes[td.node_id]
              object_proto.registered_saver.name = saver_name
              object_proto.registered_saver.object_name = td.object_name
  
      return registered_savers
  
imports: import collections
  from typing import Any, Callable, List, Optional, Tuple, Mapping, Union, Dict
  from tensorflow.core.protobuf import trackable_object_graph_pb2
  from tensorflow.python.checkpoint import graph_view
  from tensorflow.python.checkpoint import save_util_v1
  from tensorflow.python.checkpoint import saveable_compat
  from tensorflow.python.checkpoint import util
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import ops
  from tensorflow.python.saved_model import registration
  from tensorflow.python.trackable import base
  from tensorflow.python.trackable import python_state
  from tensorflow.python.trackable import trackable_utils
  from tensorflow.python.training.saving import saveable_object
  from tensorflow.python.training.saving import saveable_object_util
  from tensorflow.python.types import core
  from tensorflow.python.util import object_identity
label_desc: Use image node_id 8 for calling a global function with example usage: _get_and_write_registered_savers(registered_trackables, object_graph_proto) and returns: registered_savers