code: def fetch_haxby(
      data_dir=None,
      subjects=(2,),
      fetch_stimuli=False,
      url=None,
      resume=True,
      verbose=1,
  ):
      """Download and loads complete haxby dataset.
  
      See :footcite:t:`Haxby2001`.
  
      Parameters
      ----------
      %(data_dir)s
      subjects : list or int, default=(2,)
          Either a list of subjects or the number of subjects to load,
          from 1 to 6.
          By default, 2nd subject will be loaded.
          Empty list returns no subject data.
  
      fetch_stimuli : boolean, default=False
          Indicate if stimuli images must be downloaded.
          They will be presented as a dictionary of categories.
      %(url)s
      %(resume)s
      %(verbose)s
  
      Returns
      -------
      data : sklearn.datasets.base.Bunch
          Dictionary-like object, the interest attributes are :
  
          - 'anat': :obj:`list` of :obj:`str`. Paths to anatomic images.
          - 'func': :obj:`list` of :obj:`str`.
            Paths to nifti file with :term:`BOLD` data.
          - 'session_target': :obj:`list` of :obj:`str`.
            Paths to text file containing run and target data.
          - 'mask': :obj:`str`. Path to fullbrain mask file.
          - 'mask_vt': :obj:`list` of :obj:`str`.
            Paths to nifti ventral temporal mask file.
          - 'mask_face': :obj:`list` of :obj:`str`.
            Paths to nifti with face-reponsive brain regions.
          - 'mask_face_little': :obj:`list` of :obj:`str`.
            Spatially more constrained version of the above.
          - 'mask_house': :obj:`list` of :obj:`str`.
            Paths to nifti with house-reponsive brain regions.
          - 'mask_house_little': :obj:`list` of :obj:`str`.
            Spatially more constrained version of the above.
  
      References
      ----------
      .. footbibliography::
  
      Notes
      -----
      PyMVPA provides a tutorial making use of this dataset:
      http://www.pymvpa.org/tutorial.html
  
      More information about its structure:
      http://dev.pymvpa.org/datadb/haxby2001.html
  
      See `additional information
      <https://www.science.org/doi/10.1126/science.1063736>`
  
      Run 8 in subject 5 does not contain any task labels.
      The anatomical image for subject 6 is unavailable.
  
      """
      if isinstance(subjects, numbers.Number) and subjects > 6:
          subjects = 6
  
      if subjects is not None and isinstance(subjects, (list, tuple)):
          for sub_id in subjects:
              if sub_id not in [1, 2, 3, 4, 5, 6]:
                  raise ValueError(
                      f"You provided invalid subject id {sub_id} in a "
                      "list. Subjects must be selected in "
                      "[1, 2, 3, 4, 5, 6]"
                  )
  
      dataset_name = "haxby2001"
      data_dir = get_dataset_dir(
          dataset_name, data_dir=data_dir, verbose=verbose
      )
  
      # Get the mask
      url_mask = (
          "https://www.nitrc.org/frs/download.php/7868/mask.nii.gz"
      )
      mask = fetch_files(
          data_dir, [("mask.nii.gz", url_mask, {})], verbose=verbose
      )[0]
  
      # Dataset files
      if url is None:
          url = "http://data.pymvpa.org/datasets/haxby2001/"
      md5sums = fetch_files(
          data_dir, [("MD5SUMS", url + "MD5SUMS", {})], verbose=verbose
      )[0]
      md5sums = read_md5_sum_file(md5sums)
  
      # definition of dataset files
      sub_files = [
          "bold.nii.gz",
          "labels.txt",
          "mask4_vt.nii.gz",
          "mask8b_face_vt.nii.gz",
          "mask8b_house_vt.nii.gz",
          "mask8_face_vt.nii.gz",
          "mask8_house_vt.nii.gz",
          "anat.nii.gz",
      ]
      n_files = len(sub_files)
  
      if subjects is None:
          subjects = []
  
      if isinstance(subjects, numbers.Number):
          subject_mask = np.arange(1, subjects + 1)
      else:
          subject_mask = np.array(subjects)
  
      files = [
          (
              os.path.join(f"subj{int(i)}", sub_file),
              url + f"subj{int(i)}-2010.01.14.tar.gz",
              {
                  "uncompress": True,
                  "md5sum": md5sums.get(
                      f"subj{int(i)}-2010.01.14.tar.gz", None
                  ),
              },
          )
          for i in subject_mask
          for sub_file in sub_files
          if sub_file != "anat.nii.gz" or i != 6
      ]
  
      files = fetch_files(
          data_dir, files, resume=resume, verbose=verbose
      )
  
      if (
          isinstance(subjects, numbers.Number) and subjects == 6
      ) or np.any(subject_mask == 6):
          files.append(None)  # None value because subject 6 has no anat
  
      kwargs = {}
      if fetch_stimuli:
          stimuli_files = [
              (
                  os.path.join("stimuli", "README"),
                  url + "stimuli-2010.01.14.tar.gz",
                  {"uncompress": True},
              )
          ]
          readme = fetch_files(
              data_dir, stimuli_files, resume=resume, verbose=verbose
          )[0]
          kwargs["stimuli"] = tree(
              os.path.dirname(readme), pattern="*.jpg", dictionary=True
          )
  
      fdescr = get_dataset_descr(dataset_name)
  
      # return the data
      return Bunch(
          anat=files[7::n_files],
          func=files[0::n_files],
          session_target=files[1::n_files],
          mask_vt=files[2::n_files],
          mask_face=files[3::n_files],
          mask_house=files[4::n_files],
          mask_face_little=files[5::n_files],
          mask_house_little=files[6::n_files],
          mask=mask,
          description=fdescr,
          **kwargs,
      )
  
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 1 for calling a global function with example usage: fetch_haxby(data_dir, subjects, fetch_stimuli, url, resume, verbose) and returns: Bunch