code: def _pack_sequence_as(
      loop_vars_signature, flat_orig_loop_vars, loop_vars
  ):
      """Like `nest.pack_sequence_as` but also replaces flows with TensorArrays."""
  
      def flow_to_tensor_array(
          flow, ta
      ):  # pylint: disable=missing-docstring
          return (
              tensor_array_ops.build_ta_with_new_flow(ta, flow)
              if isinstance(  # pylint: disable=g-long-ternary
                  ta, tensor_array_ops.TensorArray
              )
              else flow
          )
  
      flattened_loop_vars = [
          flow_to_tensor_array(*z)
          for z in zip(
              nest.flatten(loop_vars, expand_composites=True),
              flat_orig_loop_vars,
          )
      ]
      return nest.pack_sequence_as(
          loop_vars_signature,
          flattened_loop_vars,
          expand_composites=True,
      )
  
imports: import collections
  from tensorflow.core.framework import attr_value_pb2
  from tensorflow.python.client import pywrap_tf_session
  from tensorflow.python.eager import backprop_util
  from tensorflow.python.framework import auto_control_deps_utils
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import func_graph
  from tensorflow.python.framework import indexed_slices
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import tensor
  from tensorflow.python.framework import tensor_shape
  from tensorflow.python.framework import tensor_spec
  from tensorflow.python.framework import tensor_util
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import control_flow_ops
  from tensorflow.python.ops import control_flow_util
  from tensorflow.python.ops import control_flow_util_v2
  from tensorflow.python.ops import default_gradient
  from tensorflow.python.ops import gen_functional_ops
  from tensorflow.python.ops import gen_resource_variable_ops
  from tensorflow.python.ops import gradients_util
  from tensorflow.python.ops import handle_data_util
  from tensorflow.python.ops import list_ops
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import tensor_array_ops
  from tensorflow.python.ops import while_v2_indexed_slices_rewriter
  from tensorflow.python.util import compat
  from tensorflow.python.util import nest
  from tensorflow.python.util import object_identity
  from tensorflow.python.util import variable_utils
label_desc: Use image node_id 20 for calling a global function with example usage: _pack_sequence_as(loop_vars_signature, flat_orig_loop_vars, loop_vars) and returns: nest, unknown