docs: def configure_event_hooks(config):
      """ Returns an EventHandler instance with registered hooks. """
  
      def print_event_info(**kwargs):
          print kwargs.get('event_params', {})
  
      def job_complete_email(email_handler, **kwargs):
          email_handler.send_job_completed(kwargs['event_params'])
  
      def job_failed_email(email_handler, **kwargs):
          email_handler.send_job_failed(kwargs['event_params'])
  
      def task_failed_email(email_handler, **kwargs):
          email_handler.send_task_failed(kwargs['event_params'])
  
      handler = EventHandler()
  
      email_handler = get_email_handler(get_conf(config, 'Dagobahd.email', None),
                                        get_conf(config, 'Email', {}))
  
      if (email_handler and
          get_conf(config, 'Email.send_on_success', False) == True):
          handler.register('job_complete', job_complete_email, email_handler)
  
      if (email_handler and
          get_conf(config, 'Email.send_on_failure', False) == True):
          handler.register('job_failed', job_failed_email, email_handler)
          handler.register('task_failed', task_failed_email, email_handler)
  
      return handler