def get_charset(message):
    """Get the charset defined for the message.

    The charset can be retrieved in two ways. Try the preferred method
    first and, if that fails, try the other method.

    Args:
        message (Message): An email Message object.

    Returns:
        (unicode) The charset that was found or `None` if not found.
    """
    charset = message.get_content_charset()
    if not charset:
        charset = message.get_charset()
    return charset