code: def test_5d(rng):
      """Test that list of 4D images with last dim=3 raises a DimensionError."""
      shape_3d = (10, 10, 10)
      shape_4d = shape_3d + (3,)
      mask = np.zeros(shape_3d)
      mask[3:7, 3:7, 3:7] = 1
      mask_img = nibabel.Nifti1Image(mask, np.eye(4))
  
      data_5d = [rng.random(shape_4d) for _ in range(5)]
      data_5d = [nibabel.Nifti1Image(d, np.eye(4)) for d in data_5d]
  
      masker = NiftiMasker(mask_img=mask_img)
      masker.fit()
  
      with pytest.raises(
          exceptions.DimensionError,
          match="Input data has incompatible dimensionality: "
          "Expected dimension is 4D and you provided "
          "a list of 4D images \\(5D\\).",
      ):
          masker.transform(data_5d)
  
imports: import os
  import shutil
  import warnings
  from tempfile import mkdtemp
  import nibabel
  import numpy
  import pytest
  from numpy.testing import assert_array_equal
  from nilearn._utils import data_gen, exceptions, testing
  from nilearn._utils.class_inspect import get_params
  from nilearn.image import get_data, index_img
  from nilearn.maskers import NiftiMasker
  from nilearn.maskers.nifti_masker import _filter_and_mask
label_desc: Use image node_id 13 for calling a global function with example usage: test_5d(rng) without return types