code: def prepare_hooks(self, hooks):
          
          # hooks can be passed as None to the prepare method and to this
          # method. To prevent iterating over None, simply use an empty list
          # if hooks is False-y
          hooks = hooks or []
          for event in hooks:
              self.register_hook(event, hooks[event])
docs: Prepares the given hooks.