code: def _validate_batch_output(batch: Block) -> None:
      if not isinstance(
          batch,
          (
              list,
              pa.Table,
              np.ndarray,
              collections.abc.Mapping,
              pd.core.frame.DataFrame,
          ),
      ):
          raise ValueError(
              "The `fn` you passed to `map_batches` returned a value of type "
              f"{type(batch)}. This isn't allowed -- `map_batches` expects "
              "`fn` to return a `pandas.DataFrame`, `pyarrow.Table`, "
              "`numpy.ndarray`, `list`, or `dict[str, numpy.ndarray]`."
          )
  
      if isinstance(batch, list):
          raise ValueError(
              f"Error validating {_truncated_repr(batch)}: "
              "Returning a list of objects from `map_batches` is not "
              "allowed in Ray 2.5. To return Python objects, "
              "wrap them in a named dict field, e.g., "
              "return `{'results': objects}` instead of just `objects`."
          )
  
      if isinstance(batch, collections.abc.Mapping):
          for key, value in list(batch.items()):
              if not is_valid_udf_return(value):
                  raise ValueError(
                      f"Error validating {_truncated_repr(batch)}: "
                      "The `fn` you passed to `map_batches` returned a "
                      f"`dict`. `map_batches` expects all `dict` values "
                      f"to be `list` or `np.ndarray` type, but the value "
                      f"corresponding to key {key!r} is of type "
                      f"{type(value)}. To fix this issue, convert "
                      f"the {type(value)} to a `np.ndarray`."
                  )
  
imports: import collections
  from types import GeneratorType
  from typing import Any, Callable, Iterable, Iterator, Optional
  import numpy
  import pandas
  import pyarrow
  import ray
  from ray.data._internal.compute import get_compute
  from ray.data._internal.execution.interfaces import PhysicalOperator
  from ray.data._internal.execution.interfaces.task_context import TaskContext
  from ray.data._internal.execution.operators.map_operator import MapOperator
  from ray.data._internal.execution.operators.map_transformer import BatchMapTransformFn, BlocksToBatchesMapTransformFn, BlocksToRowsMapTransformFn, BuildOutputBlocksMapTransformFn, MapTransformCallable, MapTransformer, Row, RowMapTransformFn
  from ray.data._internal.execution.util import make_callable_class_concurrent
  from ray.data._internal.logical.operators.map_operator import AbstractUDFMap, Filter, FlatMap, MapBatches, MapRows
  from ray.data._internal.numpy_support import is_valid_udf_return
  from ray.data._internal.util import _truncated_repr
  from ray.data.block import Block, BlockAccessor, CallableClass, DataBatch, UserDefinedFunction
  from ray.data.context import DataContext
label_desc: Use image node_id 3 for calling a global function with example usage: _validate_batch_output(batch) without return types