code: def no_int64_nifti(monkeypatch):
      """Prevent creating or writing a Nift1Image containing 64-bit ints.
  
      It is easy to create such images by mistake because Numpy uses int64 by
      default, but tools like FSL fail to read them and Nibabel will refuse to
      write them in the future.
  
      For tests that do need to manipulate int64 images, it is always possible to
      disable this fixture by parametrizing a test to override it:
  
      @pytest.mark.parametrize("no_int64_nifti", [None])
      def test_behavior_when_user_provides_int64_img():
          # ...
  
      But by default it is used automatically so that Nilearn doesn't create such
      images by mistake.
  
      """
      forbidden_types = (np.int64, np.uint64)
      error_msg = "Creating or saving an image containing 64-bit ints is forbidden."
  
      to_filename = nibabel.nifti1.Nifti1Image.to_filename
  
      def checked_to_filename(img, filename):
          assert (
              image.get_data(img).dtype not in forbidden_types
          ), error_msg
          return to_filename(img, filename)
  
      monkeypatch.setattr(
          "nibabel.nifti1.Nifti1Image.to_filename", checked_to_filename
      )
  
      init = nibabel.nifti1.Nifti1Image.__init__
  
      def checked_init(self, dataobj, *args, **kwargs):
          assert dataobj.dtype not in forbidden_types, error_msg
          return init(self, dataobj, *args, **kwargs)
  
      monkeypatch.setattr(
          "nibabel.nifti1.Nifti1Image.__init__", checked_init
      )
  
imports: import warnings
  import nibabel
  import numpy
  import pytest
  from nibabel import Nifti1Image
  from nilearn import image
  from nilearn.datasets.tests._testing import request_mocker
  from nilearn.datasets.tests._testing import temp_nilearn_data_dir
  from nilearn.experimental.surface.tests.conftest import make_mini_img, mini_img, mini_mesh
label_desc: Use image node_id 2 for calling a global function with example usage: no_int64_nifti(monkeypatch) and returns: to_filename, init