code: def fetch_atlas_schaefer_2018(
      n_rois=400,
      yeo_networks=7,
      resolution_mm=1,
      data_dir=None,
      base_url=None,
      resume=True,
      verbose=1,
  ):
      """Download and return file names for the Schaefer 2018 parcellation.
  
      .. versionadded:: 0.5.1
  
      This function returns a :term:`Deterministic atlas`, and the provided
      images are in MNI152 space.
  
      For more information on this dataset, see :footcite:t:`schaefer_atlas`,
      :footcite:t:`Schaefer2017`,
      and :footcite:t:`Yeo2011`.
  
      Parameters
      ----------
      n_rois : {100, 200, 300, 400, 500, 600, 700, 800, 900, 1000}, default=400
          Number of regions of interest.
  
      yeo_networks : {7, 17}, default=7
          ROI annotation according to yeo networks.
  
      resolution_mm : {1, 2}, default=1mm
          Spatial resolution of atlas image in mm.
      %(data_dir)s
      base_url : :obj:`str`, optional
          Base URL of files to download (``None`` results in
          default ``base_url``).
      %(resume)s
      %(verbose)s
  
      Returns
      -------
      data : :class:`sklearn.utils.Bunch`
          Dictionary-like object, contains:
  
              - 'maps': :obj:`str`, path to nifti file containing the
                3D :class:`~nibabel.nifti1.Nifti1Image` (its shape is
                ``(182, 218, 182)``). The values are consecutive integers
                between 0 and ``n_rois`` which can be interpreted as indices
                in the list of labels.
              - 'labels': :class:`numpy.ndarray` of :obj:`str`, array
                containing the ROI labels including Yeo-network annotation.
  
                  .. warning::
                      The list of labels does not contain 'Background' by
                      default. To have proper indexing, you should either
                      manually add 'Background' to the list of labels:
  
                      .. code-block:: python
  
                          # Prepend background label
                          data.labels = np.insert(data.labels, 0, "Background")
  
                      Or be careful that the indexing should be offset by one:
  
                      .. code-block:: python
  
                          # Get region ID of label '7Networks_LH_Vis_3' when
                          # 'Background' was not added to the list of labels:
                          # idx should be equal to 3:
                          idx = np.where(data.labels == b"7Networks_LH_Vis_3")[0] + 1
  
  
  
              - 'description': :obj:`str`, short description of the atlas
                and some references.
  
      References
      ----------
      .. footbibliography::
  
  
      Notes
      -----
      Release v0.14.3 of the Schaefer 2018 parcellation is used by
      default. Versions prior to v0.14.3 are known to contain erroneous region
      label names. For more details, see
      https://github.com/ThomasYeoLab/CBIG/blob/master/stable_projects/brain_parcellation/Schaefer2018_LocalGlobal/Parcellations/Updates/Update_20190916_README.md # noqa: E501
  
      Licence: MIT.
  
      """
      valid_n_rois = list(range(100, 1100, 100))
      valid_yeo_networks = [7, 17]
      valid_resolution_mm = [1, 2]
      if n_rois not in valid_n_rois:
          raise ValueError(
              f"Requested n_rois={n_rois} not available. "
              f"Valid options: {valid_n_rois}"
          )
      if yeo_networks not in valid_yeo_networks:
          raise ValueError(
              f"Requested yeo_networks={yeo_networks} not available. "
              f"Valid options: {valid_yeo_networks}"
          )
      if resolution_mm not in valid_resolution_mm:
          raise ValueError(
              f"Requested resolution_mm={resolution_mm} not available. "
              f"Valid options: {valid_resolution_mm}"
          )
  
      if base_url is None:
          base_url = (
              "https://raw.githubusercontent.com/ThomasYeoLab/CBIG/"
              "v0.14.3-Update_Yeo2011_Schaefer2018_labelname/"
              "stable_projects/brain_parcellation/"
              "Schaefer2018_LocalGlobal/Parcellations/MNI/"
          )
  
      files = []
      labels_file_template = (
          "Schaefer2018_{}Parcels_{}Networks_order.txt"
      )
      img_file_template = "Schaefer2018_{}Parcels_{}Networks_order_FSLMNI152_{}mm.nii.gz"
      for f in [
          labels_file_template.format(n_rois, yeo_networks),
          img_file_template.format(n_rois, yeo_networks, resolution_mm),
      ]:
          files.append((f, base_url + f, {}))
  
      dataset_name = "schaefer_2018"
      data_dir = get_dataset_dir(
          dataset_name, data_dir=data_dir, verbose=verbose
      )
      labels_file, atlas_file = fetch_files(
          data_dir, files, resume=resume, verbose=verbose
      )
  
      labels = np.genfromtxt(
          labels_file,
          usecols=1,
          dtype="S",
          delimiter="\t",
          encoding=None,
      )
      fdescr = get_dataset_descr(dataset_name)
  
      return Bunch(maps=atlas_file, labels=labels, description=fdescr)
  
imports: import json
  import os
  import re
  import shutil
  import warnings
  import xml.etree.ElementTree
  from pathlib import Path
  from tempfile import mkdtemp
  import nibabel
  import numpy
  import pandas
  from sklearn.utils import Bunch
  from .._utils import check_niimg, fill_doc
  from ..image import get_data, new_img_like, reorder_img
  from ._utils import fetch_files, get_dataset_descr, get_dataset_dir
label_desc: Use image node_id 24 for calling a global function with example usage: fetch_atlas_schaefer_2018(n_rois, yeo_networks, resolution_mm, data_dir, base_url, resume, verbose) and returns: Bunch