docs: def register_trigger(when=None, when_not=None, set_flag=None, clear_flag=None):
      """
      Register a trigger to set or clear a flag when a given flag is set.
  
      Note: Flag triggers are handled at the same time that the given flag is set.
  
      :param str when: Flag to trigger on when it is set.
      :param str when_not: Flag to trigger on when it is cleared.
      :param str set_flag: If given, this flag will be set when `when` is set.
      :param str clear_flag: If given, this flag will be cleared when `when` is set.
  
      Note: Exactly one of either `when` or `when_not`, and at least one of
      `set_flag` or `clear_flag` must be provided.
      """
      if not any((when, when_not)):
          raise ValueError('Must provide one of when or when_not')
      if all((when, when_not)):
          raise ValueError('Only one of when or when_not can be provided')
      if not any((set_flag, clear_flag)):
          raise ValueError('Must provide at least one of set_flag or clear_flag')
      trigger = _get_trigger(when, when_not)
      if set_flag and set_flag not in trigger['set_flag']:
          trigger['set_flag'].append(set_flag)
      if clear_flag and clear_flag not in trigger['clear_flag']:
          trigger['clear_flag'].append(clear_flag)
      _save_trigger(when, when_not, trigger)