code: def _check_affine(affine):
      """Check positive, isotropic, near-diagonal affine."""
      assert affine[0, 0] == affine[1, 1]
      assert affine[2, 2] == affine[1, 1]
      assert affine[0, 0] > 0
  
      A, b = image.resampling.to_matrix_vector(affine)
      assert np.all(
          (np.abs(A) > 0.001).sum(axis=0) == 1
      ), "the affine transform was not near-diagonal"
  
imports: import base64
  import warnings
  from io import BytesIO
  import numpy
  import pytest
  from matplotlib import pyplot
  from nibabel import Nifti1Image
  from nilearn import datasets, image
  from nilearn.image import get_data, new_img_like
  from nilearn.plotting import html_stat_map
  from ..js_plotting_utils import colorscale
label_desc: Use image node_id 3 for calling a global function with example usage: _check_affine(affine) without return types