def pairlist2dict(lst):
    """take a list containing key,values pairs and return
    a dict where each key holds a list of matching values.
    """
    dct = {}
    for ky, vle in lst:
        if ky in dct:
            dct[ky].append(vle)
        else:
            dct[ky] = [vle]
    return dct
