allow consumption of generator in restricted python