code: def _save_function_alias(
      saved_model_dir: str,
      tags: Collection[str],
      function_aliases: Mapping[str, str],
  ) -> None:
      """Saves the function alias to the SavedModel.
  
      SavedModelBuilder (TF1 saved model saver) does not support saving function
      aliases, so this function loads the SavedModel proto and adds the
      `function_aliases` field.
  
      Args:
        saved_model_dir: Path to the saved model directory.
        tags: A collection of tags to specify the meta graph.
        function_aliases: Function name -> function alias mapping.
      """
      loader = saved_model_loader.SavedModelLoader(saved_model_dir)
      meta_graph_def = loader.get_meta_graph_def_from_tags(tags)
  
      for function_name, function_alias in function_aliases.items():
          meta_graph_def.meta_info_def.function_aliases[
              function_name
          ] = function_alias
  
      saved_model_proto_serialized = (
          loader.saved_model.SerializeToString()
      )
  
      # TODO(b/266015731): Also update and set the SavedModel fingerprint.
      path = file_io.join(
          saved_model_dir, saved_model_constants.SAVED_MODEL_FILENAME_PB
      )
      file_io.atomic_write_string_to_file(
          path, saved_model_proto_serialized
      )
  
imports: from typing import Collection, Dict, Mapping, Optional, Sequence
  from absl import logging
  from google.protobuf.any_pb2 import Any
  from tensorflow.core.framework import graph_pb2
  from tensorflow.core.protobuf import meta_graph_pb2
  from tensorflow.core.protobuf import saver_pb2
  from tensorflow.python.client import session
  from tensorflow.python.framework import importer
  from tensorflow.python.framework import ops
  from tensorflow.python.lib.io import file_io
  from tensorflow.python.saved_model import builder
  from tensorflow.python.saved_model import constants
  from tensorflow.python.saved_model import loader_impl
  from tensorflow.python.saved_model import tag_constants
  from tensorflow.python.training import saver
label_desc: Use image node_id 6 for calling a global function with example usage: _save_function_alias(saved_model_dir, tags, function_aliases) without return types