code: def _write_bids_raw_func(
      func_path,
      fields,
      n_voxels,
      rand_gen,
  ):
      """Create BIDS functional raw nifti, json sidecar and events files.
  
      Parameters
      ----------
      func_path : :obj:`Path`
          Path to a subject functional directory.
  
      file_id : :obj:`str`
          Root of the BIDS filename:
          typically basename without the BIDS suffix and extension.
  
      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.
  
      """
      n_time_points = 30
      bold_path = func_path / create_bids_filename(fields)
  
      write_fake_bold_img(
          bold_path,
          [n_voxels, n_voxels, n_voxels, n_time_points],
          random_state=rand_gen,
      )
  
      repetition_time = 1.5
      fields["extension"] = "json"
      param_path = func_path / create_bids_filename(fields)
      param_path.write_text(
          json.dumps({"RepetitionTime": repetition_time})
      )
  
      fields["suffix"] = "events"
      fields["extension"] = "tsv"
      events_path = func_path / create_bids_filename(fields)
      basic_paradigm().to_csv(events_path, sep="\t", index=None)
  
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 24 for calling a global function with example usage: _write_bids_raw_func(func_path, fields, n_voxels, rand_gen) without return types