def rfind(self, sub ,start = 0 ,end = sys.maxsize):
        '''S.rfind(sub [,start [,end]]) -> int
        
        Return the highest index in S where substring sub is found,
        such that sub is contained within S[start:end].  Optional
        arguments start and end are interpreted as in slice notation.
        
        Return -1 on failure.
        '''
        string = self[start:end]
        # corner cases
        if string == '':
            return 0 if sub == '' else -1
        if sub == '':
            return len(string)+start

        c = 0
        it = StringSearch(sub,self,self._factory.collator)
        it.setAttribute(USearchAttribute.OVERLAP,False)
        r = it.last()
        while r>= 0:
            match = it.getMatchedText()
            if self.__class__(match) == self.__class__(sub):
                return start + r
            r = it.preceding(r)
        return r