docs: def add_event(self, name, data=None):
      '''
      Add an event of type *name* to the queue. May raise a
      `ValueError` if the event type is mergeable and *data* is not None
      or if *name* is not a declared event type (in strict mode).
      '''
  
      try:
        mergeable = self.event_types[name].mergeable
      except KeyError:
        if self.strict:
          raise ValueError('unknown event type {0!r}'.format(name))
        mergeable = False
  
      if mergeable and data is not None:
        raise ValueError('mergable event can not have data attached')
  
      with self.lock:
        if mergeable:
          # Check if such an event already exists.
          for ev in self.events:
            if ev.type == name:
              return
  
        self.events.append(self.Event(name, data, time.clock()))