def get_filename_variant(file_name, resource_suffix_map):
    # Given a filename
    # Get a list of variant IDs, and the root file name
    file_name_parts = os.path.splitext(file_name)
    if file_name_parts[0] == '~':
        raise Exception('Cannot start a file name with a ~ character')
    split = file_name_parts[0].split("~")
    tags = split[1:]
    try:
        ids = [resource_suffix_map['~'+tag] for tag in tags]
    except __HOLE__ as key:
        raise ValueError('Unrecognised tag %s' % key)
    root_file_name = split[0] + file_name_parts[1]
    return ids, root_file_name
dataset/ETHPy150Open pebble/cloudpebble/ide/tasks/archive.py/get_filename_variant