code: def _pack_named_sequence(flat_inputs, input_spec, batch_shape):
      """Assembles back a nested structure that has been flattened."""
      named_inputs = []
      for flat_input, spec in zip(
          flat_inputs, tf.nest.flatten(input_spec)
      ):
          named_input = tf.identity(flat_input, name=spec.name)
          if not tf.executing_eagerly():
              named_input.set_shape(batch_shape.concatenate(spec.shape))
          named_inputs.append(named_input)
  
      nested_inputs = tf.nest.pack_sequence_as(input_spec, named_inputs)
      return nested_inputs
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import contextlib
  from multiprocessing import pool
  import threading
  from typing import Any, Optional, Text
  from absl import logging
  import gin
  import numpy
  import tensorflow
  from tf_agents.environments import batched_py_environment
  from tf_agents.environments import py_environment
  from tf_agents.environments import tf_environment
  from tf_agents.specs import tensor_spec
  from tf_agents.typing import types
  from tensorflow.python.framework import tensor_shape
label_desc: Use image node_id 1 for calling a global function with example usage: _pack_named_sequence(flat_inputs, input_spec, batch_shape) and returns: nested_inputs