def METHOD_NAME(license, charset):
    if not charset:
        return
    try:
        return license.decode(charset)
    except UnicodeDecodeError:
        if charset in ('ISO-8859-1', 'ISO-8859-15'):
            if b'\xff' in license:
                return METHOD_NAME(license, 'ISO-8859-13')
            if b'\xd2' in license and b'\xd3' in license:
                return METHOD_NAME(license, 'mac_roman')