def group(iterable, count):
    """returns elements from the iterable grouped by count
    The last set, possibly incomplete, is also returned"""
    itr = iter(iterable)
    while True:
        chunk = []
        for _i in range(count):
            try:
                chunk.append(next(itr))
            except StopIteration:
                if chunk:
                    yield chunk
                return
        yield chunk
