@dec
def gen1(x):

    def gen2(x):
        if x <= 10:
            yield x
for v in gen2(x + 1):
    yield v
for v in gen2(x):
    yield v
for i in gen1(1):
    pass
How to decorate a generator in python