def make_dict_from_csv(fn):
    """
    convert listing of partial permutations with multiplicity into dict
    input file should have one line for each "type" of ballot
    - first entry is number of ballots of this type
    - successive entries are ranked candidates (no non-votes or repeats)
    - all candidates are comma-separated
    """
    d = dict()
    for x in open(fn,'r'):
        line = x.rstrip().split(',')
        lbl = '_'.join(line[1:])
        if lbl not in d.keys():
            d[lbl] = int(line[0])
        else:
            d[lbl] += int(line[0])
        # print("%d -- %s" % (int(line[0]),lbl))
    return d