code: def _mock_bids_dataset(
      bids_path,
      n_sub,
      n_ses,
      tasks,
      n_runs,
      entities,
      n_voxels,
      rand_gen,
  ):
      """Create a fake raw :term:`bids<BIDS>` dataset directory with dummy files.
  
      Parameters
      ----------
      base_dir : :obj:`Path`
          Path where to create the fake :term:`BIDS` dataset.
  
      n_sub : :obj:`int`
          Number of subjects to be simulated in the dataset.
  
      n_ses : :obj:`int`
          Number of sessions to be simulated in the dataset.
          Ignored if n_ses=0.
  
      tasks : :obj:`list` of :obj:`str`
          List of tasks to be simulated in the dataset.
  
      n_runs : :obj:`list` of :obj:`int`
          Number of runs to create, where each element indicates the
          number of runs for the corresponding task.
          No run entity will be used if a value is equal to 1 or less.
  
      entities : :obj:`dict`, optional
          Extra entities to add to the BIDS filename with a list of values.
  
      n_voxels : :obj:`int`
          Number of voxels along a given axis in the functional image.
  
      rand_gen : :obj:`numpy.random.RandomState` instance
          Random number generator.
  
      """
      bids_path.mkdir(parents=True, exist_ok=True)
  
      bids_path.joinpath("README.txt").write_text("")
  
      for subject, session in itertools.product(
          _listify(n_sub), _listify(n_ses)
      ):
          subses_dir = bids_path / f"sub-{subject}"
          if session != "":
              subses_dir = subses_dir / f"ses-{session}"
  
          if session in ("01", ""):
              _write_bids_raw_anat(subses_dir, subject, session)
  
          func_path = subses_dir / "func"
          func_path.mkdir(parents=True, exist_ok=True)
  
          for task, n_run in zip(tasks, n_runs):
              for run in _listify(n_run):
                  if entities:
                      for key in entities:
                          for label in entities[key]:
                              fields = _init_fields(
                                  subject=subject,
                                  session=session,
                                  task=task,
                                  run=run,
                              )
                              if key in bids_entities()["raw"]:
                                  fields["entities"][key] = label
                              _write_bids_raw_func(
                                  func_path=func_path,
                                  fields=fields,
                                  n_voxels=n_voxels,
                                  rand_gen=rand_gen,
                              )
  
                  else:
                      fields = _init_fields(
                          subject=subject,
                          session=session,
                          task=task,
                          run=run,
                      )
                      _write_bids_raw_func(
                          func_path=func_path,
                          fields=fields,
                          n_voxels=n_voxels,
                          rand_gen=rand_gen,
                      )
  
imports: from __future__ import annotations
  import itertools
  import json
  import string
  from pathlib import Path
  import numpy
  import pandas
  import scipy.linalg
  import scipy.signal
  from nibabel import Nifti1Image
  from scipy.ndimage import binary_dilation
  from nilearn import datasets, image, maskers, masking
  from nilearn._utils import as_ndarray, logger
  from nilearn.interfaces.bids.utils import bids_entities, check_bids_label, create_bids_filename
  from nilearn.interfaces.fmriprep.tests._testing import get_legal_confound
label_desc: Use image node_id 19 for calling a global function with example usage: _mock_bids_dataset(bids_path, n_sub, n_ses, tasks, n_runs, entities, n_voxels, rand_gen) without return types