def sets_to_contingency(a, b, N):
    """
    Creates a contingency table from two sets.
    params:
        a, b: sets to compare
        N: total number of possible items
    returns:
        (f11, f10, f01, f00) tuple of contingency table entries:
        f11 = # of items both in a and b
        f10 = # of items only in a
        f01 = # of items only in b
        f00 = # of items not in either a or b
    """
    f11 = len(a.intersection(b))
    f10 = len(a) - f11
    f01 = len(b) - f11
    f00 = N - (f11 + f10 + f01)
    return (f11, f10, f01, f00)