def take_by(iterable, count):
    "\n    Returns elements from the input iterable by batches of N items.\n    ('abcdefg', 3) -> ['a', 'b', 'c'], ['d', 'e', 'f'], ['g']\n    "
    it = iter(iterable)
    while True:
        batch = list(islice(it, count))
        if (len(batch) == 0):
            break
        (yield batch)
Returns elements from the input iterable by batches of N items.
('abcdefg', 3) -> ['a', 'b', 'c'], ['d', 'e', 'f'], ['g']
def take_by(iterable, count):
    "\n    Returns elements from the input iterable by batches of N items.\n    ('abcdefg', 3) -> ['a', 'b', 'c'], ['d', 'e', 'f'], ['g']\n    "
    it = iter(iterable)
    while True:
        batch = list(islice(it, count))
        if (len(batch) == 0):
            break
        (yield batch)