code: def _get_data(img):
      # copy-pasted from
      # https://github.com/nipy/nibabel/blob/de44a105c1267b07ef9e28f6c35b31f851d5a005/nibabel/dataobj_images.py#L204 # noqa
      #
      # get_data is removed from nibabel because:
      # see https://github.com/nipy/nibabel/wiki/BIAP8
      if img._data_cache is not None:
          return img._data_cache
      data = np.asanyarray(img._dataobj)
      img._data_cache = data
      return data
  
file_path: nilearn/nilearn/_utils/niimg.py
imports: import collections.abc
  import copy
  import gc
  from pathlib import Path
  from warnings import warn
  import nibabel
  import numpy
  from .helpers import stringify_path
label_desc: Use image node_id 1 for calling a global function with example usage: _get_data(img) and returns: data, img