code: def _serialize_function_spec(function_spec):
      """Serialize a FunctionSpec object into its proto representation."""
      if (
          function_spec.fullargspec.args
          and function_spec.fullargspec.args[0] == "self"
      ):
          raise TypeError(
              "Can not serialize tf.function with unbound 'self' parameter."
          )
  
      proto = saved_object_graph_pb2.FunctionSpec()
  
      # Intentionally skip encoding annotations of a function because function
      # annotations are mainly for optional type checking during development
      # and does not affect runtime behavior.
      # https://www.python.org/dev/peps/pep-3107/
      # https://docs.python.org/3/library/inspect.html#inspect.getfullargspec
      proto.fullargspec.CopyFrom(
          nested_structure_coder.encode_structure(
              function_spec.fullargspec._replace(annotations={})
          )
      )
  
      proto.is_method = False
      proto.input_signature.CopyFrom(
          nested_structure_coder.encode_structure(
              function_spec.input_signature
          )
      )
  
      # See `tf.function` and the JitCompile proto for details.
      proto.jit_compile = {
          None: saved_object_graph_pb2.FunctionSpec.JitCompile.DEFAULT,
          True: saved_object_graph_pb2.FunctionSpec.JitCompile.ON,
          False: saved_object_graph_pb2.FunctionSpec.JitCompile.OFF,
      }.get(function_spec.jit_compile)
  
      return proto
  
file_path: tensorflow/tensorflow/python/saved_model/function_serialization.py
imports: from tensorflow.core.function.polymorphism import function_type
  from tensorflow.core.protobuf import saved_object_graph_pb2
  from tensorflow.python.eager import function
  from tensorflow.python.eager import wrap_function
  from tensorflow.python.eager.polymorphic_function import function_type_utils
  from tensorflow.python.framework import func_graph
  from tensorflow.python.saved_model import nested_structure_coder
  from tensorflow.python.util import nest
label_desc: Use image node_id 1 for calling a global function with example usage: _serialize_function_spec(function_spec) and returns: proto