code: def _try_convert_to_tensor_spec(arg, dtype_hint):
      """Returns None or TensorSpec obtained if `arg` is converted to tensor."""
      try:
          # Note: try conversion in a FuncGraph to avoid polluting current context.
          with func_graph_lib.FuncGraph(
              name="guess_conversion"
          ).as_default():
              result = ops.convert_to_tensor(arg, dtype_hint=dtype_hint)
              return tensor.TensorSpec(
                  shape=result.shape, dtype=result.dtype
              )
      except (TypeError, ValueError):
          return None
  
imports: import collections
  import pprint
  import re
  from absl import logging
  from tensorflow.core.function import trace_type
  from tensorflow.core.function.polymorphism import function_type
  from tensorflow.core.protobuf import saved_object_graph_pb2
  from tensorflow.python.eager import def_function
  from tensorflow.python.eager import function
  from tensorflow.python.eager.polymorphic_function import function_type_utils
  from tensorflow.python.framework import func_graph
  from tensorflow.python.framework import function_def_to_graph
  from tensorflow.python.framework import op_def_registry
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import tensor
  from tensorflow.python.framework import type_spec
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import custom_gradient
  from tensorflow.python.ops import default_gradient
  from tensorflow.python.ops import resource_variable_ops
  from tensorflow.python.saved_model import nested_structure_coder
  from tensorflow.python.util import compat
  from tensorflow.python.util import nest
  from tensorflow.python.util import tf_decorator
  from tensorflow.python.util import tf_inspect
label_desc: Use image node_id 3 for calling a global function with example usage: _try_convert_to_tensor_spec(arg, dtype_hint) and returns: tensor, None