def SeekToLast(self):
        """
        Jump to last key in database

        @return: self
        @rtype: Iter
        """
        # if we have no prefix or the last possible prefix of this length, just
        # seek to the last key in the db.
        if self._prefix is None or self._prefix == "\xff" * len(self._prefix):
            self._impl.SeekToLast()
            return self

        # we have a prefix. see if there's anything after our prefix.
        # there's probably a much better way to calculate the Next prefix.
        hex_prefix = self._prefix.encode('hex')
        Next_prefix = hex(long(hex_prefix, 16) + 1)[2:].rstrip("L")
        Next_prefix = Next_prefix.rjust(len(hex_prefix), "0")
        Next_prefix = Next_prefix.decode("hex").rstrip("\x00")
        self._impl.seek(Next_prefix)
        if self._impl.Valid():
            # there is something after our prefix. we're on it, so step back
            self._impl.Prev()
        else:
            # there is nothing after our prefix, just seek to the last key
            self._impl.SeekToLast()
        return self

        Jump to last key in database

        @return: self
        @rtype: Iter
        
pymclevel/leveldb.py