transfor genfunc to return a generator obj and cps its body