<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def hook(self, name):
 """ Return a decorator that attaches a callback to a hook. """

        def wrapper(func):
            self.hooks.add(name, func)
            return func
        return wrapper