<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, fn):
 """ Tell the object to run `fn` whenever a message of type `event` is received. """

        self._callbacks.setdefault(event, []).append(fn)
        return fn