def allIntersections(frozenSets):
    universalSet = frozenset.union(*frozenSets)
intersections = set([universalSet])
for s in frozenSets:
    moreIntersections = set(s & t for t in intersections)
intersections.update(moreIntersections)
return intersections

def all_intersections(lists):
    sets = allIntersections([frozenset(s) for s in lists])
return [list(s) for s in sets]
Как быстро получить все пересечения наборов в python