code: def _gen_gradient_func(func):
      """Wraps a ConcreteFunction to be compatible with the gradient registry."""
  
      def gradient_func(unused_op, *result_grads):
          result_grads = [
              x if x is not None else default_gradient.zeros_like(t)
              for (x, t) in zip(result_grads, func.graph.inputs)
          ]
          return func(*result_grads)
  
      return gradient_func
  
imports: from typing import Any, Callable, Iterator, Optional, Union
  from tensorflow.core.framework import attr_value_pb2
  from tensorflow.core.framework import function_pb2
  from tensorflow.core.function.capture import restore_captures
  from tensorflow.core.function.runtime_client import runtime_client
  from tensorflow.python.eager import def_function
  from tensorflow.python.eager import function
  from tensorflow.python.framework import func_graph
  from tensorflow.python.framework import function_def_to_graph
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import tensor
  from tensorflow.python.ops import custom_gradient
  from tensorflow.python.ops import default_gradient
  from tensorflow.python.ops import handle_data_util
  from tensorflow.python.platform import tf_logging
  from tensorflow.python.util import compat
label_desc: Use image node_id 4 for calling a global function with example usage: _gen_gradient_func(func) and returns: gradient_func, func