def format_msg(message):
    """
    Used to format user messages.
    Replaces newline characters with spaces, '\\n' with newlines, etc.
    :type message: str
    :rtype: str
    """
    return (
        message
            .strip()
            .replace('\\n\n', '\\n')
            .replace('\n', ' ')
            .replace('\\n', '\n')
    )