def prepare_hooks(self, hooks):
    'Prepares the given hooks.'
    hooks = (hooks or [])
    for event in hooks:
        self.register_hook(event, hooks[event])
Prepares the given hooks.
def prepare_hooks(self, hooks):
    
    hooks = (hooks or [])
    for event in hooks:
        self.register_hook(event, hooks[event])