code: def _mask_trigs(events, mask, mask_type):
      """Mask digital trigger values."""
      _check_option("mask_type", mask_type, ["not_and", "and"])
      if mask is not None:
          _validate_type(mask, "int", "mask", "int or None")
      n_events = len(events)
      if n_events == 0:
          return events.copy()
  
      if mask is not None:
          if mask_type == "not_and":
              mask = np.bitwise_not(mask)
          elif mask_type != "and":
              raise ValueError(
                  "'mask_type' should be either 'and'"
                  " or 'not_and', instead of '%s'" % mask_type
              )
          events[:, 1:] = np.bitwise_and(events[:, 1:], mask)
      events = events[events[:, 1] != events[:, 2]]
  
      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 11 for calling a global function with example usage: _mask_trigs(events, mask, mask_type) and returns: events, events