code: def sample_spec_nest(structure, rng, outer_dims=()):
      """Samples the given nest of specs.
  
      Args:
        structure: An `ArraySpec`, or a nested dict, list or tuple of `ArraySpec`s.
        rng: A numpy RandomState to use for the sampling.
        outer_dims: An optional list/tuple specifying outer dimensions to add to the
          spec shape before sampling.
  
      Returns:
        A nest of sampled values following the ArraySpec definition.
      """
  
      def sample_fn(spec):
          spec = BoundedArraySpec.from_spec(spec)
          spec = BoundedArraySpec(
              tuple(outer_dims) + tuple(spec.shape),
              spec.dtype,
              spec.minimum,
              spec.maximum,
              spec.name,
          )
          return sample_bounded_spec(spec, rng)
  
      return tf.nest.map_structure(sample_fn, structure)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import numbers
  import gin
  import numpy
  import tensorflow
label_desc: Use image node_id 2 for calling a global function with example usage: sample_spec_nest(structure, rng, outer_dims) and returns: tf, sample_bounded_spec