def iteritems(self, collect=False):
        """ Iterate through the items in this list. If `collect` is True,
        yield only one item for each unique key, each with a list of
        associated values.

        >>> kvl = KeyValueList([('red', 'rose'), ('blue', 'sea'),
        ... ('green', 'grass'), ('blue', 'sky')])
        >>> for key in kvl.iteritems():
        ...     print(key)
        ('red', 'rose')
        ('blue', 'sea')
        ('green', 'grass')
        ('blue', 'sky')
        >>> for key in kvl.iteritems(collect=True):
        ...     print(key)
        ('red', ['rose'])
        ('blue', ['sea', 'sky'])
        ('green', ['grass'])

        """
        if collect:
            keys, items = [], []
            for k, v in self:
                try:
                    index = keys.index(k)
                except __HOLE__:
                    keys.append(k)
                    items.append((k, [v]))
                else:
                    items[index][1].append((v))
            for item in items:
                yield item
        else:
            for item in self:
                yield item
dataset/ETHPy150Open nigelsmall/httpstream/httpstream/kvlist.py/KeyValueList.iteritems