code: def convert_nest_lists_to_np_array(
      nested_list: types.NestedTensorOrArray,
  ) -> Union[Tuple[Any], np.ndarray]:
      """Convert nest lists to numpy array.
  
      Args:
        nested_list: A nested strucutre of lists.
  
      Raises:
        ValueError: If the input is not
          collections_abc.Mapping/tuple/list/np.ndarray.
  
      Returns:
        A nested structure of numpy arrays.
      """
      if isinstance(nested_list, collections_abc.Mapping):
          ordered_items = [
              (k, convert_nest_lists_to_np_array(v))
              for k, v in nested_list.items()
          ]
          if isinstance(nested_list, collections.defaultdict):
              subset = type(nested_list)(
                  nested_list.default_factory, ordered_items
              )
          else:
              subset = type(nested_list)(ordered_items)
          return subset
      elif isinstance(nested_list, tuple):
          return tuple(
              convert_nest_lists_to_np_array(v) for v in nested_list
          )
      elif isinstance(nested_list, list):
          return np.array(nested_list, np.float32)
      elif isinstance(nested_list, np.ndarray):
          # Converting all dtype to be float32 makes it easier to do CEM loop.
          # The dtype of the final sampled action will be converted back according
          # to the spec in the sampler.
          if nested_list.dtype != np.float32:
              nested_list = nested_list.astype(np.float32)
          return nested_list
      else:
          raise ValueError("The nested type is not supported.")
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import collections
  from typing import Any, Optional, Sequence, Tuple, Union
  import gin
  import numpy
  import tensorflow
  import tensorflow_probability
  from tf_agents.networks import network
  from tf_agents.networks import utils
  from tf_agents.policies import tf_policy
  from tf_agents.policies.samplers import qtopt_cem_actions_sampler
  from tf_agents.trajectories import policy_step
  from tf_agents.trajectories import time_step
  from tf_agents.typing import types
  from tf_agents.utils import common
  from tf_agents.utils import nest_utils
label_desc: Use image node_id 1 for calling a global function with example usage: convert_nest_lists_to_np_array(nested_list) and returns: subset, tuple, np, nested_list