def f(g): yield 'begin' for x in g(): yield x print('end')