def subsets_of_fileinfo_from_txt(filename):
    if not os.path.isfile(filename):
        raise ValueError("File " + filename + " not found!")
    with open(filename) as f:
        file_content = f.read().splitlines()
    dict_of_subsets_of_fileinfo = {}
    label = None
    sublist_of_fileinfo = []
    idict = 0
    ifiles = 0
    nfiles = 0
    sublist_finished = True
    for line in file_content:
        if len(line) > 0:
            if line[0] != '
                if label is None:
                    if line[0] == "@":
                        nfiles = int(line[1:].split()[0])
                        label = line[1:].split()[1]
                        sublist_of_fileinfo = []
                        ifiles = 0
                        sublist_finished = False
                    else:
                        raise ValueError("Expected @ symbol not found!")
                else:
                    if line[0] == "@":
                        raise ValueError("Unexpected @ symbol found!")
                    tmplist = line.split()
                    tmpfile = tmplist[0]
                    if len(tmplist) > 1:
                        tmpinfo = tmplist[1:]
                    else:
                        tmpinfo = None
                    if not os.path.isfile(tmpfile):
                        raise ValueError("File " + tmpfile + " not found!")
                    sublist_of_fileinfo.append(FileInfo(tmpfile, tmpinfo))
                    ifiles += 1
                    if ifiles == nfiles:
                        dict_of_subsets_of_fileinfo[idict] = {}
                        tmpdict = dict_of_subsets_of_fileinfo[idict]
                        tmpdict['label'] = label
                        tmpdict['list_of_fileinfo'] = sublist_of_fileinfo
                        idict += 1
                        label = None
                        sublist_of_fileinfo = []
                        ifiles = 0
                        sublist_finished = True
    if not sublist_finished:
        raise ValueError("Unexpected end of sublist of files.")
    return dict_of_subsets_of_fileinfo