def split_iterable_as_iterable(self, values):
    'Group iterable into iterables, in the order of the keys\n\n        Parameters\n        ----------\n        values : iterable of length equal to keys\n            iterable of values to be grouped\n\n        Yields\n        ------\n        iterable of items in values\n\n        Notes\n        -----\n        Memory consumption depends on the amount of sorting required\n        Worst case, if index.sorter[-1] = 0, we need to consume the entire value iterable,\n        before we can start yielding any output\n        But to the extent that the keys are already sorted, the grouping is lazy\n        '
    values = iter(enumerate(values))
    cache = dict()

    def get_value(ti):
        try:
            return cache.pop(ti)
        except:
            while True:
                (i, v) = next(values)
                if (i == ti):
                    return v
                cache[i] = v
    s = iter(self.index.sorter)
    for c in self.count:
        (yield (get_value(i) for i in itertools.islice(s, int(c))))
Group iterable into iterables, in the order of the keys

Parameters
----------
values : iterable of length equal to keys
    iterable of values to be grouped

Yields
------
iterable of items in values

Notes
-----
Memory consumption depends on the amount of sorting required
Worst case, if index.sorter[-1] = 0, we need to consume the entire value iterable,
before we can start yielding any output
But to the extent that the keys are already sorted, the grouping is lazy
def split_iterable_as_iterable(self, values):
    'Group iterable into iterables, in the order of the keys\n\n        Parameters\n        ----------\n        values : iterable of length equal to keys\n            iterable of values to be grouped\n\n        Yields\n        ------\n        iterable of items in values\n\n        Notes\n        -----\n        Memory consumption depends on the amount of sorting required\n        Worst case, if index.sorter[-1] = 0, we need to consume the entire value iterable,\n        before we can start yielding any output\n        But to the extent that the keys are already sorted, the grouping is lazy\n        '
    values = iter(enumerate(values))
    cache = dict()

    def get_value(ti):
        try:
            return cache.pop(ti)
        except:
            while True:
                (i, v) = next(values)
                if (i == ti):
                    return v
                cache[i] = v
    s = iter(self.index.sorter)
    for c in self.count:
        (yield (get_value(i) for i in itertools.islice(s, int(c))))