'Prunes candidate sets whose frequency < support threshold.
Returns a dictionary of (candidate set, frequency)-items.'

def Lk(self, sets, candidates, support=0.0):

    (Lk, x) = ({}, (1.0 / (len(sets) or 1)))
    for s1 in candidates:
        for s2 in sets:
            if s1.issubset(s2):
                Lk[s1] = (((s1 in Lk) and (Lk[s1] + x)) or x)
    return dict(((s, f) for (s, f) in Lk.items() if (f >= support)))
