code: def test_too_many_dims():
      data0 = np.zeros(list(range(2, 9)))
      xyz_names = talairach_csm(3).coord_names
      cmap = AT(CS("ijktuvw"), CS(xyz_names + tuple("tuvw")), np.eye(8))
      assert nipy2nifti(Image(data0, cmap)).shape == tuple(range(2, 9))
      # Too many dimensions
      data1 = np.zeros(list(range(2, 10)))
      cmap = AT(
          CS("ijktuvwq"), CS(xyz_names + tuple("tuvwq")), np.eye(9)
      )
      pytest.raises(NiftiError, nipy2nifti, Image(data1, cmap))
      # No time adds a dimension
      cmap = AT(CS("ijkpuvw"), CS(xyz_names + tuple("puvw")), np.eye(8))
      pytest.raises(NiftiError, nipy2nifti, Image(data0, cmap))
  
imports: import warnings
  from copy import copy
  import nibabel
  import numpy
  import pytest
  from nibabel.affines import from_matvec
  from nibabel.spatialimages import HeaderDataError
  from numpy.testing import assert_array_equal
  from ...core.api import AffineTransform
  from ...core.api import CoordinateSystem
  from ...core.api import Image
  from ...core.reference.spaces import aligned_csm, mni_csm, scanner_csm, talairach_csm, unknown_csm, unknown_space, vox2mni
  from ...testing import anatfile, funcfile
  from ..files import load
  from ..nibcompat import get_affine, get_header
  from ..nifti_ref import NiftiError, nifti2nipy, nipy2nifti
label_desc: Use image node_id 12 for calling a global function with example usage: test_too_many_dims() without return types