code: def _assert_many_arrays_ndim(arrs, ndim, shape_str, to_ntype):
      # For polygons, this can be a list of lists of arrays, hence we must
      # flatten the lists here.
      # itertools.chain.from_iterable() seems to flatten the arrays too, so it
      # cannot be used here.
      iterable_type_str = "iterable"
      if len(arrs) == 0:
          arrs_flat = []
      elif ia.is_np_array(arrs[0]):
          arrs_flat = arrs
      else:
          iterable_type_str = "iterable of iterable"
          arrs_flat = [
              arr for arrs_sublist in arrs for arr in arrs_sublist
          ]
  
      if any([arr.ndim != ndim for arr in arrs_flat]):
          raise ValueError(
              "Tried to convert an %s of arrays to a list of "
              "%s. Expected each array to be of shape %s, "
              "i.e. to be %d-dimensional, but got dimensions %s "
              "instead (array shapes: %s)."
              % (
                  iterable_type_str,
                  to_ntype,
                  shape_str,
                  ndim,
                  ", ".join([str(arr.ndim) for arr in arrs_flat]),
                  ", ".join([str(arr.shape) for arr in arrs_flat]),
              )
          )
  
imports: from __future__ import print_function, division, absolute_import
  import functools
  import numpy
  from ..None import imgaug
  from ..None import dtypes
  from .base import IAugmentable
label_desc: Use image node_id 4 for calling a global function with example usage: _assert_many_arrays_ndim(arrs, ndim, shape_str, to_ntype) without return types