def count(self, i):
        """rangeobject.count(value) -> integer -- return number of occurrences
        of value
        """
        if self._stop > self._start and self._step > 0:
            return int(self._start <= i < self._stop and
                       (i - self._start) % self._step == 0)
        elif self._stop < self._start and self._step < 0:
            return int(self._start >= i > self._stop and
                       (i - self._start) % self._step == 0)
        else:
            return False