def METHOD_NAME(iterable, batch_size):
    # Taken from https://code.activestate.com/recipes/303279-getting-items-in-batches/
    i = iter(iterable)
    while True:
        batchiter = itertools.islice(i, batch_size)
        try:
            yield itertools.chain([next(batchiter)], batchiter)
        except StopIteration:
            return