def printer(generator):
    group = None
for grp, num in generator:
    if grp != group:
        print('These numbers are in group %s:' % grp)
group = grp
print('\t%s' % num)
Can a Python function take a generator and return generators to subsets of its generated output?