code: def fetch_abide_pcp(
      data_dir=None,
      n_subjects=None,
      pipeline="cpac",
      band_pass_filtering=False,
      global_signal_regression=False,
      derivatives=["func_preproc"],
      quality_checked=True,
      url=None,
      verbose=1,
      legacy_format=True,
      **kwargs,
  ):
      """Fetch ABIDE dataset.
  
      Fetch the Autism Brain Imaging Data Exchange (ABIDE) dataset wrt criteria
      that can be passed as parameter. Note that this is the preprocessed
      version of ABIDE provided by the preprocess connectome projects (PCP).
      See :footcite:t:`Nielsen2013`.
  
      Parameters
      ----------
      %(data_dir)s
      n_subjects : :obj:`int`, optional
          The number of subjects to load. If None is given,
          all available subjects are used (this number depends on the
          preprocessing pipeline used).
  
      pipeline : :obj:`str` {'cpac', 'css', 'dparsf', 'niak'}, default='cpac'
          Possible pipelines are "ccs", "cpac", "dparsf" and "niak".
  
      band_pass_filtering : :obj:`bool`, default=False
          Due to controversies in the literature, band pass filtering is
          optional. If true, signal is band filtered between 0.01Hz and 0.1Hz.
  
      global_signal_regression : :obj:`bool`, default=False
          Indicates if global signal regression should be applied on the
          signals.
  
      derivatives : :obj:`list` of :obj:`str`, default=['func_preproc']
          Types of downloaded files. Possible values are: alff, degree_binarize,
          degree_weighted, dual_regression, eigenvector_binarize,
          eigenvector_weighted, falff, func_mask, func_mean, func_preproc, lfcd,
          reho, rois_aal, rois_cc200, rois_cc400, rois_dosenbach160, rois_ez,
          rois_ho, rois_tt, and vmhc. Please refer to the PCP site for more
          details.
  
      quality_checked : :obj:`bool`, default=True
          If true (default), restrict the list of the subjects to the one that
          passed quality assessment for all raters.
      %(url)s
      %(verbose)s
      %(legacy_format)s
      kwargs : parameter list, optional
          Any extra keyword argument will be used to filter downloaded subjects
          according to the CSV phenotypic file. Some examples of filters are
          indicated below.
  
      SUB_ID : list of integers in [50001, 50607], optional
          Ids of the subjects to be loaded.
  
      DX_GROUP : integer in {1, 2}, optional
          1 is autism, 2 is control.
  
      DSM_IV_TR : integer in [0, 4], optional
          O is control, 1 is autism, 2 is Asperger, 3 is PPD-NOS,
          4 is Asperger or PPD-NOS.
  
      AGE_AT_SCAN : float in [6.47, 64], optional
          Age of the subject.
  
      SEX : integer in {1, 2}, optional
          1 is male, 2 is female.
  
      HANDEDNESS_CATEGORY : string in {'R', 'L', 'Mixed', 'Ambi'}, optional
          R = Right, L = Left, Ambi = Ambidextrous.
  
      HANDEDNESS_SCORE : integer in [-100, 100], optional
          Positive = Right, Negative = Left, 0 = Ambidextrous.
  
      Returns
      -------
      data : :class:`sklearn.utils.Bunch`
          Dictionary-like object, the keys are described below.
  
      - 'description': :obj:`str`, description of the dataset.
  
      - 'phenotypic': :obj:`pandas.DataFrame`
        phenotypic information for each subject.
  
      - Specific Derivative Keys:
        Additional keys,'func_preproc' being the default, are
        introduced based on the provided 'derivatives'
        parameter during fetching. Any combination of the
        parameters below may occur.
  
          - 'func_preproc' (default): :obj:`numpy.ndarray`,
            paths to preprocessed functional MRI data in NIfTI format.
            This key is present by default when fetching the dataset.
          - 'alff': :obj:`numpy.ndarray`,
            amplitude values of low-frequency fluctuations
            in functional MRI data.
          - 'degree_binarize': :obj:`numpy.ndarray`,
            data specific to binarized node degree in brain networks.
          - 'degree_weighted': :obj:`numpy.ndarray`,
            data specific to weighted node degree,
            considering connectivity strength in brain networks.
          - 'dual_regression': :obj:`numpy.ndarray`,
            results from dual regression analysis,
            often involving the identification of resting-state networks.
          - 'eigenvector_binarize': :obj:`numpy.ndarray`,
            data specific to binarized eigenvector
            centrality, a measure of node influence in brain networks.
          - 'eigenvector_weighted': :obj:`numpy.ndarray`,
            data specific to weighted eigenvector
            centrality, reflecting node influence with consideration
            of connectivity strength.
          - 'falff': :obj:`numpy.ndarray`,
            data specific to fractional amplitude values of
            low-frequency fluctuations.
          - 'func_mask': :obj:`numpy.ndarray`,
            functional mask data, often used to define regions of interest.
          - 'func_mean': :obj:`numpy.ndarray`,
            mean functional MRI data,
            representing average activity across the brain.
          - 'lfcd': :obj:`numpy.ndarray`,
            data specific to local functional connectivity density
            in brain networks.
          - 'reho': :obj:`numpy.ndarray`,
            data specific to regional homogeneity in functional MRI data.
          - 'rois_aal': :obj:`numpy.ndarray`,
            data specific to anatomical regions
            defined by the Automatic Anatomical Labeling atlas.
          - 'rois_cc200': :obj:`numpy.ndarray`
            data specific to regions defined by the Craddock 200 atlas.
          - 'rois_cc400': :obj:`numpy.ndarray`,
            data specific to regions defined by the Craddock 400 atlas.
          - 'rois_dosenbach160': :obj:`numpy.ndarray`,
            data specific to regions defined by the Dosenbach 160 atlas.
          - 'rois_ez': :obj:`numpy.ndarray`,
            data specific to regions defined by the EZ atlas.
          - 'rois_ho': :obj:`numpy.ndarray`,
            data specific to regions defined by the Harvard-Oxford atlas.
          - 'rois_tt': :obj:`numpy.ndarray`,
            data specific to regions defined by the Talairach atlas.
          - 'vmhc': :obj:`numpy.ndarray`,
            data specific to voxel-mirrored homotopic connectivity in
            functional MRI data.
  
      Notes
      -----
      Code and description of preprocessing pipelines are provided on the
      `PCP website <http://preprocessed-connectomes-project.github.io/>`_.
  
      References
      ----------
      .. footbibliography::
  
      """
      # People keep getting it wrong and submitting a string instead of a
      # list of strings. We'll make their life easy
      if isinstance(derivatives, str):
          derivatives = [derivatives]
  
      # Parameter check
      for derivative in derivatives:
          if derivative not in [
              "alff",
              "degree_binarize",
              "degree_weighted",
              "dual_regression",
              "eigenvector_binarize",
              "eigenvector_weighted",
              "falff",
              "func_mask",
              "func_mean",
              "func_preproc",
              "lfcd",
              "reho",
              "rois_aal",
              "rois_cc200",
              "rois_cc400",
              "rois_dosenbach160",
              "rois_ez",
              "rois_ho",
              "rois_tt",
              "vmhc",
          ]:
              raise KeyError(f"{derivative} is not a valid derivative")
  
      strategy = ""
      if not band_pass_filtering:
          strategy += "no"
      strategy += "filt_"
      if not global_signal_regression:
          strategy += "no"
      strategy += "global"
  
      # General file: phenotypic information
      dataset_name = "ABIDE_pcp"
      data_dir = get_dataset_dir(
          dataset_name, data_dir=data_dir, verbose=verbose
      )
      if url is None:
          url = (
              "https://s3.amazonaws.com/fcp-indi/data/Projects/"
              "ABIDE_Initiative"
          )
  
      if quality_checked:
          kwargs["qc_rater_1"] = "OK"
          kwargs["qc_anat_rater_2"] = ["OK", "maybe"]
          kwargs["qc_func_rater_2"] = ["OK", "maybe"]
          kwargs["qc_anat_rater_3"] = "OK"
          kwargs["qc_func_rater_3"] = "OK"
  
      # Fetch the phenotypic file and load it
      csv = "Phenotypic_V1_0b_preprocessed1.csv"
      path_csv = fetch_files(
          data_dir, [(csv, f"{url}/{csv}", {})], verbose=verbose
      )[0]
  
      # Note: the phenotypic file contains string that contains comma which mess
      # up numpy array csv loading. This is why I do a pass to remove the last
      # field. This can be
      # done simply with pandas but we don't want such dependency ATM
      # pheno = pandas.read_csv(path_csv).to_records()
      with open(path_csv) as pheno_f:
          pheno = [f"i{pheno_f.readline()}"]
  
          # This regexp replaces commas between double quotes
          pheno.extend(
              re.sub(r',(?=[^"]*"(?:[^"]*"[^"]*")*[^"]*$)', ";", line)
              for line in pheno_f
          )
      # bytes (encode()) needed for python 2/3 compat with numpy
      pheno = "\n".join(pheno).encode()
      pheno = BytesIO(pheno)
      pheno = pd.read_csv(pheno, comment="$")
  
      # First, filter subjects with no filename
      pheno = pheno[pheno["FILE_ID"] != "no_filename"]
      # Apply user defined filters
      user_filter = filter_columns(pheno, kwargs)
      pheno = pheno[user_filter]
  
      # Go into specific data folder and url
      data_dir = os.path.join(data_dir, pipeline, strategy)
      url = "/".join([url, "Outputs", pipeline, strategy])
  
      # Get the files
      file_ids = pheno["FILE_ID"].tolist()
      if n_subjects is not None:
          file_ids = file_ids[:n_subjects]
          pheno = pheno[:n_subjects]
  
      if legacy_format:
          warnings.warn(_LEGACY_FORMAT_MSG, DeprecationWarning)
          pheno = pheno.to_records(index=False)
  
      results = {
          "description": get_dataset_descr(dataset_name),
          "phenotypic": pheno,
      }
      for derivative in derivatives:
          ext = ".1D" if derivative.startswith("rois") else ".nii.gz"
          files = []
          for file_id in file_ids:
              file_ = [
                  (
                      f"{file_id}_{derivative}{ext}",
                      "/".join(
                          [
                              url,
                              derivative,
                              f"{file_id}_{derivative}{ext}",
                          ]
                      ),
                      {},
                  )
              ]
              files.append(
                  fetch_files(data_dir, file_, verbose=verbose)[0]
              )
          # Load derivatives if needed
          if ext == ".1D":
              files = [np.loadtxt(f) for f in files]
          results[derivative] = files
      return Bunch(**results)
  
imports: import fnmatch
  import glob
  import json
  import numbers
  import os
  import re
  import warnings
  from io import BytesIO
  from pathlib import Path
  import nibabel
  import nibabel
  import numpy
  import pandas
  from scipy.io import loadmat
  from sklearn.utils import Bunch
  from nilearn.image import get_data
  from .._utils import check_niimg, fill_doc
  from .._utils.numpy_conversions import csv_to_array
  from ._utils import fetch_files, fetch_single_file, filter_columns, get_dataset_descr, get_dataset_dir, read_md5_sum_file, tree, uncompress_file
label_desc: Use image node_id 9 for calling a global function with example usage: fetch_abide_pcp(data_dir, n_subjects, pipeline, band_pass_filtering, global_signal_regression, derivatives, quality_checked, url, verbose, legacy_format) and returns: Bunch