code: def pick_events(events, include=None, exclude=None, step=False):
      """Select some :term:`events`.
  
      Parameters
      ----------
      %(events)s
      include : int | list | None
          A event id to include or a list of them.
          If None all events are included.
      exclude : int | list | None
          A event id to exclude or a list of them.
          If None no event is excluded. If include is not None
          the exclude parameter is ignored.
      step : bool
          If True (default is False), events have a step format according
          to the argument output='step' in the function find_events().
          In this case, the two last columns are considered in inclusion/
          exclusion criteria.
  
      Returns
      -------
      events : array, shape (n_events, 3)
          The list of events.
      """
      if include is not None:
          include = _check_integer_or_list(include, "include")
          mask = np.zeros(len(events), dtype=bool)
          for e in include:
              mask = np.logical_or(mask, events[:, 2] == e)
              if step:
                  mask = np.logical_or(mask, events[:, 1] == e)
          events = events[mask]
      elif exclude is not None:
          exclude = _check_integer_or_list(exclude, "exclude")
          mask = np.ones(len(events), dtype=bool)
          for e in exclude:
              mask = np.logical_and(mask, events[:, 2] != e)
              if step:
                  mask = np.logical_and(mask, events[:, 1] != e)
          events = events[mask]
      else:
          events = np.copy(events)
  
      if len(events) == 0:
          raise RuntimeError("No events found")
  
      return events
  
imports: from collections.abc import Sequence
  from pathlib import Path
  import numpy
  from ._fiff.constants import FIFF
  from ._fiff.open import fiff_open
  from ._fiff.pick import pick_channels
  from ._fiff.tag import read_tag
  from ._fiff.tree import dir_tree_find
  from ._fiff.write import end_block, start_and_end_file, start_block, write_int
  from .utils import _check_fname, _check_integer_or_list, _check_on_missing, _check_option, _get_stim_channel, _on_missing, _pl, _validate_type, check_fname, fill_doc, logger, verbose, warn
label_desc: Use image node_id 1 for calling a global function with example usage: pick_events(events, include, exclude, step) and returns: events