code: def _check_data_batch(data, batch_size, layout):
      shape, uniform = _get_batch_shape(data)
      if len(shape) > batch_size:
          raise RuntimeError(
              f"The external source callback returned an unexpected batch "
              f"size. Expected batch_size <= {batch_size}, actual: {len(shape)}"
          )
  
      if len(shape) > 0:
          dim = len(shape[0])
          if not uniform:
              for ts in shape:
                  if len(ts) != dim:
                      raise RuntimeError(
                          "All tensors in a batch must have the same number of dimensions"
                      )
          if layout is not None and layout != "" and dim != len(layout):
              raise RuntimeError(
                  f"The layout '{layout}' cannot describe {dim}-dimensional data"
              )
  
imports: from nvidia.dali import backend
  from nvidia.dali import tensors
  from nvidia.dali import types
  from nvidia.dali._multiproc.messages import TaskArgs, SampleRange
  import nvidia.dali.types
  from nvidia.dali._utils.external_source_impl import get_callback_from_source, accepted_arg_count, SourceKind
label_desc: Use image node_id 2 for calling a global function with example usage: _check_data_batch(data, batch_size, layout) without return types