code: def register(self, event, callback):
          
          pattern = self.channels.event_pattern(event)
          entry = self.callbacks.get(pattern)
          if not entry:
              entry = event_callbacks(event, pattern, re.compile(pattern), [])
              self.callbacks[entry.pattern] = entry
  
          if callback not in entry.callbacks:
              entry.callbacks.append(callback)
  
          return entry
docs: Register a ``callback`` for ``event``