code: def _get_events_files(
      dataset_path,
      sub_label,
      task_label,
      img_filters,
      imgs,
      verbose,
  ):
      """Get events.tsv files for a given subject, task and filters.
  
      Also checks that the number of events.tsv files
      matches the number of images.
  
      Parameters
      ----------
      dataset_path : :obj:`str`
          Directory of the derivatives BIDS dataset.
  
      sub_label : :obj:`str`
          Subject label as specified in the file names like sub-<sub_label>_.
  
      task_label : :obj:`str`
          Task label as specified in the file names like _task-<task_label>_.
  
      img_filters : :obj:`list` of :obj:`tuple` (str, str)
          Filters are of the form (field, label).
          Only one filter per field allowed.
  
      imgs : :obj:`list` of :obj:`str`
          List of fullpath to the preprocessed images
  
      verbose : :obj:`integer`
          Indicate the level of verbosity.
  
      Returns
      -------
      events : :obj:`list` of :obj:`str`
          List of fullpath to the events files
      """
      events_filters = _make_bids_files_filter(
          task_label=task_label,
          supported_filters=bids_entities()["raw"],
          extra_filter=img_filters,
          verbose=verbose,
      )
      events = get_bids_files(
          dataset_path,
          modality_folder="func",
          file_tag="events",
          file_type="tsv",
          sub_label=sub_label,
          filters=events_filters,
      )
      if verbose:
          _report_found_files(
              files=events,
              text="events",
              sub_label=sub_label,
              filters=events_filters,
          )
      _check_bids_events_list(
          events=events,
          imgs=imgs,
          sub_label=sub_label,
          task_label=task_label,
          dataset_path=dataset_path,
          events_filters=events_filters,
          verbose=verbose,
      )
      return events
  
imports: from __future__ import annotations
  import csv
  import glob
  import os
  import sys
  import time
  from pathlib import Path
  from warnings import warn
  import numpy
  import pandas
  from joblib import Memory, Parallel, delayed
  from nibabel import Nifti1Image
  from sklearn.base import clone
  from sklearn.cluster import KMeans
  from nilearn._utils import fill_doc, stringify_path
  from nilearn._utils.niimg_conversions import check_niimg
  from nilearn._utils.param_validation import check_run_sample_masks
  from nilearn.glm._base import BaseGLM
  from nilearn.glm.contrasts import compute_fixed_effect_contrast, expression_to_contrast_vector
  from nilearn.glm.first_level.design_matrix import make_first_level_design_matrix
  from nilearn.glm.regression import ARModel, OLSModel, RegressionResults, SimpleRegressionResults
  from nilearn.image import get_data
  from nilearn.interfaces.bids import get_bids_files, parse_bids_filename
  from nilearn.interfaces.bids.query import infer_repetition_time_from_dataset, infer_slice_timing_start_time_from_dataset
  from nilearn.interfaces.bids.utils import bids_entities, check_bids_label
  from nilearn.interfaces.fmriprep.load_confounds import load_confounds
label_desc: Use image node_id 17 for calling a global function with example usage: _get_events_files(dataset_path, sub_label, task_label, img_filters, imgs, verbose) and returns: events