BadRows = set()
for rowID, row in enumerate(Rows):
    Intersections = dict()
for userID in row:
    for rowID_cmp in Sets[userID]:
        if rowID_cmp != rowID:
            Intersections[rowID_cmp] = Intersections.get(rowID_cmp, 0) + 1
filteredOut = False
for rowID_cmp in Intersections:
    if Intersections[rowID_cmp] >= filterValue:
        BadRows.add(rowID_cmp)
filteredOut = True
if filteredOut:
    BadRows.add(rowID)
Python compare every line in file with all others