def get_messenger(config):
email_settings = EmailConfig(config)<EOL>if config.get("<STR_LIT>") == "<STR_LIT>":<EOL><INDENT>return DebugMessenger(email_settings)<EOL><DEDENT>problems = email_settings.validate()<EOL>if problems:<EOL><INDENT>logger.info(problems + "<STR_LIT>")<EOL>return DebugMessenger(email_settings)<EOL><DEDENT>return EmailingMessenger(email_settings)<EOL>
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.