Get the message charset

def get_charset(message, default='ASCII'):
    """Get the message charset"""

    charset = message.get_content_charset()

    if not charset:
        charset = message.get_charset()

    if not charset:
        charset = default

    try:
        codecs.lookup(charset)
    except LookupError:
        charset = default

    return charset