code: def to_input_signature(function_type):
      """Extracts an input_signature from function_type instance."""
      constrained_parameters = list(function_type.parameters.keys())
  
      # self does not have a constraint in input_signature
      if "self" in constrained_parameters:
          constrained_parameters.pop(0)
  
      # There are no parameters to constrain.
      if not constrained_parameters:
          return tuple()
  
      constraints = []
      is_auto_constrained = False
  
      for parameter_name in constrained_parameters:
          parameter = function_type.parameters[parameter_name]
          constraint = None
          if parameter.type_constraint:
              # Generate legacy constraint representation.
              constraint = parameter.type_constraint.placeholder_value(
                  trace_type.InternalPlaceholderContext(
                      unnest_only=True
                  )
              )
              if any(
                  not isinstance(arg, tensor.TensorSpec)
                  for arg in nest.flatten(
                      [constraint], expand_composites=True
                  )
              ):
                  # input_signature only supports contiguous TensorSpec composites
                  is_auto_constrained = True
                  break
              else:
                  constraints.append(constraint)
  
      # All constraints were generated by FunctionType
      if is_auto_constrained and not constraints:
          return tuple()
  
      # If the list is empty then there was no input_signature specified.
      return tuple(constraints) if constraints else None
  
imports: import functools
  import inspect
  from typing import Any, Dict, Tuple
  import six
  from tensorflow.core.function import trace_type
  from tensorflow.core.function.polymorphism import function_type
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import tensor
  from tensorflow.python.framework import type_spec
  from tensorflow.python.ops import resource_variable_ops
  from tensorflow.python.util import nest
label_desc: Use image node_id 4 for calling a global function with example usage: to_input_signature(function_type) and returns: unknown, tuple, tuple