Returns the last element accessed via next() or prev().
        Returns the first element of range() if neither of these was called.

def last(self):
        """Returns the last element accessed via next() or prev().
        Returns the first element of range() if neither of these was called."""
        if len(self._range) == 0:
            raise IndexError("range is empty")
        if self._idx == -1:
            return self._range[0]
        return self._get(self._idx)