code: def optimize_concrete_function(
      concrete_function: function.ConcreteFunction,
      strip_control_dependencies: bool,
  ) -> wrap_function.WrappedFunction:
      """Returns optimized function with same signature as `concrete_function`."""
      wrapped_fn = wrap_function.WrappedFunction(
          concrete_function.graph,
          variable_holder=wrap_function.VariableHolder(
              share_variables=True
          ),
      )
      fetches = concrete_function.structured_outputs
      if strip_control_dependencies:
          (
              flat_outputs,
              _,
          ) = tf2_utils.strip_and_get_tensors_and_control_dependencies(
              tf.nest.flatten(fetches, expand_composites=True)
          )
          fetches = tf.nest.pack_sequence_as(
              concrete_function.structured_outputs,
              flat_outputs,
              expand_composites=True,
          )
      result = wrapped_fn.prune(
          feeds=concrete_function.inputs,
          fetches=fetches,
          input_signature=concrete_function.structured_input_signature,
      )
      # TODO(b/163329414): Remove once `prune` retains shape information for all
      # components.
      for original_out, pruned_out in zip(
          concrete_function.outputs, result.outputs
      ):
          pruned_out.set_shape(original_out.get_shape())
      return result
  
imports: from typing import Any, Dict, Iterable, Mapping, Tuple, Union
  import tensorflow
  from tensorflow_transform import annotators
  from tensorflow_transform import common_types
  from tensorflow_transform import graph_tools
  from tensorflow_transform import tf2_utils
  from tensorflow_transform import tf_utils
  from tensorflow_transform.py_func import pyfunc_helper
  from tensorflow_transform.saved import constants
  from tensorflow_transform.saved import saved_model_loader
  from tensorflow_transform.saved import saved_transform_io
  from tensorflow.python.eager import function
  from tensorflow.python.eager import wrap_function
  from tensorflow.python.framework import composite_tensor
  from tensorflow.python.ops import lookup_ops
  from tensorflow.python.util import object_identity
label_desc: Use image node_id 5 for calling a global function with example usage: optimize_concrete_function(concrete_function, strip_control_dependencies) and returns: result