def iterate_chunks(i, size=<NUM_LIT:10>):
accumulator = []<EOL>for n, i in enumerate(i):<EOL><INDENT>accumulator.append(i)<EOL>if (n+<NUM_LIT:1>) % size == <NUM_LIT:0>:<EOL><INDENT>yield accumulator<EOL>accumulator = []<EOL><DEDENT><DEDENT>if accumulator:<EOL><INDENT>yield accumulator<EOL><DEDENT>
Iterate over an iterator ``i`` in ``size`` chunks, yield chunks.
Similar to pagination.

Example::

    >>> list(iterate_chunks([1, 2, 3, 4], size=2))
    [[1, 2], [3, 4]]