def iterkeys(self, collect=False):
        """ Iterate through the keys in this list. If `collect` is True,
        yield only unique keys.

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

        """
        if collect:
            keys = []
            for k, v in self:
                if k not in keys:
                    keys.append(k)
                    yield k
        else:
            for k, v in self:
                yield k
dataset/ETHPy150Open nigelsmall/httpstream/httpstream/kvlist.py/KeyValueList.iterkeys/original