I found this function on the internet:
def combos(els, l): if l == 1: return [(k,) for k, v in els.items() if v] cs = [] for e in els: