def hook(self, name):
def decorator(func):<EOL><INDENT>self.add_hook(name, func)<EOL>return func<EOL><DEDENT>return decorator<EOL>
Return a decorator that attaches a callback to a hook. See
            :meth:`add_hook` for details.