code: def get_messenger(config):
      
      email_settings = EmailConfig(config)
      if config.get("mode") == "debug":
          return DebugMessenger(email_settings)
      problems = email_settings.validate()
      if problems:
          logger.info(problems + " Will log errors instead of emailing them.")
          return DebugMessenger(email_settings)
      return EmailingMessenger(email_settings)
docs: Return an appropriate Messenger.
  
      If we're in debug mode, or email settings aren't set, return a debug
      version which logs the message instead of attempting to send a real
      email.