def __getitem__(self, item):
        if self._cache_complete:
            return self._cache[item]
        elif isinstance(item, slice):
            if item.step and item.step < 0:
                return list(iter(self))[item]
            else:
                return list(itertools.islice(self,
                                             item.start or 0,
                                             item.stop or sys.maxint,
                                             item.step or 1))
        elif item >= 0:
            gen = iter(self)
            try:
                for i in range(item+1):
                    res = gen.next()
            except __HOLE__:
                raise IndexError
            return res
        else:
            return list(iter(self))[item]
dataset/ETHPy150Open CouchPotato/CouchPotatoV1/library/dateutil/rrule.py/rrulebase.__getitem__