defgen():try:yield1exceptValueError:print("got ValueError from upstream!")yield"str1"raiseTypeErrordefgen2():print((yield fromgen()))g=gen2()print(next(g))print(g.throw(ValueError))try:print(next(g))exceptTypeError:print("got TypeError from downstream!")