Return buffer from generator function.