<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def register(self, event, callback):
 """Register a ``callback`` for ``event`` """

        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