code: def test_check_niimg(img_3d_zeros_eye, img_4d_zeros_eye):
      img_3_3d = [[[img_3d_zeros_eye, img_3d_zeros_eye]]]
      img_2_4d = [[img_4d_zeros_eye, img_4d_zeros_eye]]
  
      with pytest.raises(
          DimensionError,
          match="Input data has incompatible dimensionality: "
          "Expected dimension is 2D and you provided "
          "a list of list of list of 3D images \\(6D\\)",
      ):
          _utils.check_niimg(img_3_3d, ensure_ndim=2)
  
      with pytest.raises(
          DimensionError,
          match="Input data has incompatible dimensionality: "
          "Expected dimension is 4D and you provided "
          "a list of list of 4D images \\(6D\\)",
      ):
          _utils.check_niimg(img_2_4d, ensure_ndim=4)
  
      # check data dtype equal with dtype='auto'
      img_3d_check = _utils.check_niimg(img_3d_zeros_eye, dtype="auto")
      assert (
          get_data(img_3d_zeros_eye).dtype.kind
          == get_data(img_3d_check).dtype.kind
      )
  
      img_4d_check = _utils.check_niimg(img_4d_zeros_eye, dtype="auto")
      assert (
          get_data(img_4d_zeros_eye).dtype.kind
          == get_data(img_4d_check).dtype.kind
      )
  
imports: import os
  import re
  import tempfile
  from pathlib import Path
  import nibabel
  import numpy
  import pytest
  from nibabel import Nifti1Image
  from numpy.testing import assert_array_equal
  import nilearn
  from nilearn import _utils
  from nilearn._utils import niimg_conversions, testing
  from nilearn._utils.exceptions import DimensionError
  from nilearn._utils.niimg_conversions import iter_check_niimg
  from nilearn._utils.testing import assert_memory_less_than, with_memory_profiler
  from nilearn.image import get_data
label_desc: Use image node_id 5 for calling a global function with example usage: test_check_niimg(img_3d_zeros_eye, img_4d_zeros_eye) without return types