def pick_set(n, i):
    """Return the i-1'th set in the cardinally-ordered powerset of {0..n-1}"""
s, i = find_size(n, i)
result = []
for k in range(s, 0, -1):
    prev_c = 0
for v in range(k, n + 1):
    c = comb(v, k)
if i < c:
    result.append(v - 1)
i -= prev_c
break
prev_c = c
return tuple(result)
Index into size ordered power set