def i_batch(max_size, iterable):
iterable_items = iter(iterable)<EOL>for items_batch in iter(lambda: tuple(islice(iterable_items, max_size)),<EOL>tuple()):<EOL><INDENT>yield items_batch<EOL><DEDENT>
Generator that iteratively batches items
to a max size and consumes the items iterable
as each batch is yielded.

:param max_size: Max size of each batch.
:type max_size: int
:param iterable: An iterable
:type iterable: iter