code: def fetch_icbm152_brain_gm_mask(
      data_dir=None, threshold=0.2, resume=True, n_iter=2, verbose=1
  ):
      """Download ICBM152 template first, then loads the 'gm' mask.
  
       %(templateflow)s
  
      .. versionadded:: 0.2.5
  
      Parameters
      ----------
      %(data_dir)s
      threshold : float, default=0.2
          Values of the ICBM152 grey-matter template above this threshold will be
          included.
  
      %(resume)s
      n_iter: int, default=2
          Number of repetitions of :term:`dilation<Dilation>`
          and :term:`erosion<Erosion>` steps performed in
          scipy.ndimage.binary_closing function.
  
          .. versionadded:: 0.8.1
  
      %(verbose)s
  
      Returns
      -------
      gm_mask_img : Nifti1Image, image corresponding to the brain grey matter
          from ICBM152 template.
  
      Notes
      -----
      This function relies on ICBM152 templates where we particularly pick
      grey matter template and threshold the template at .2 to take one fifth
      of the values. Then, do a bit post processing such as binary closing
      operation to more compact mask image.
  
      .. note::
          It is advised to check the mask image with your own data processing.
  
      See Also
      --------
      nilearn.datasets.fetch_icbm152_2009: for details regarding the ICBM152
          template.
  
      nilearn.datasets.load_mni152_template: for details about version of MNI152
          template and related.
  
      """
      # Fetching ICBM152 grey matter mask image
      icbm = fetch_icbm152_2009(
          data_dir=data_dir, resume=resume, verbose=verbose
      )
      gm = icbm["gm"]
      gm_img = check_niimg(gm)
      gm_data = get_data(gm_img)
  
      # getting one fifth of the values
      gm_mask = (gm_data > threshold).astype("int8")
  
      gm_mask = binary_closing(gm_mask, iterations=n_iter)
      gm_mask_img = new_img_like(gm_img, gm_mask)
  
      return gm_mask_img
  
imports: import functools
  import os
  import warnings
  from pathlib import Path
  import numpy
  import pandas
  from scipy.ndimage import binary_closing
  from sklearn.utils import Bunch
  from .._utils import check_niimg, fill_doc
  from ..image import get_data, new_img_like, resampling
  from ._utils import fetch_files, get_dataset_descr, get_dataset_dir
label_desc: Use image node_id 8 for calling a global function with example usage: fetch_icbm152_brain_gm_mask(data_dir, threshold, resume, n_iter, verbose) and returns: gm_mask_img