import string


def string_format(msg, method):
    """Format a string (upper, lower, formal, sentence).

    :param str msg: The user's message.
    :param str method: One of ``uppercase``, ``lowercase``,
        ``sentence`` or ``formal``.

    :return str: The reformatted string.
    """
    if method == "uppercase":
        return msg.upper()
    elif method == "lowercase":
        return msg.lower()
    elif method == "sentence":
        return msg.capitalize()
    elif method == "formal":
        return string.capwords(msg)