code: def assert_arrays_spec_nest(arrays, spec):
      """Check that the arrays conform to the spec.
  
      Args:
        arrays: A NumPy array, or a nested dict, list or tuple of arrays.
        spec: An `ArraySpec`, or a nested dict, list or tuple of `ArraySpec`s.
  
      Raise:
        A TypeError or ValueError describing the mismatch.
      """
      tf.nest.assert_same_structure(arrays, spec)
  
      def assert_array_spec(array, spec):
          if not isinstance(spec, ArraySpec):
              raise TypeError(
                  f'The spec "{spec}" is not an ArraySpec, instead "{type(spec)}"'
              )
          if not spec.check_array(array):
              raise ValueError(
                  f'The value "{array}" does not match spec: {spec}'
              )
  
      # Check all the elements in arrays match to their spec
      tf.nest.map_structure(assert_array_spec, arrays, spec)
  
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 4 for calling a global function with example usage: assert_arrays_spec_nest(arrays, spec) without return types