'Stem a Russian word and return the stemmed form.
:param word: The word that is stemmed.
:type word: str or unicode
:return: The stemmed form.
:rtype: unicode'

def stem(self, word):

    if (word in self.stopwords):
        return word
    chr_exceeded = False
    for i in range(len(word)):
        if (ord(word[i]) > 255):
            chr_exceeded = True
            break
    if chr_exceeded:
        word = self.__cyrillic_to_roman(word)
    step1_success = False
    adjectival_removed = False
    verb_removed = False
    undouble_success = False
    superlative_removed = False
    (rv, r2) = self.__regions_russian(word)
    for suffix in self.__perfective_gerund_suffixes:
        if rv.endswith(suffix):
            if (suffix in (u'v', u'vshi', u"vshis'")):
                if ((rv[((- len(suffix)) - 3):(- len(suffix))] == u'i^a') or (rv[((- len(suffix)) - 1):(- len(suffix))] == u'a')):
                    word = word[:(- len(suffix))]
                    r2 = r2[:(- len(suffix))]
                    rv = rv[:(- len(suffix))]
                    step1_success = True
                    break
            else:
                word = word[:(- len(suffix))]
                r2 = r2[:(- len(suffix))]
                rv = rv[:(- len(suffix))]
                step1_success = True
                break
    if (not step1_success):
        for suffix in self.__reflexive_suffixes:
            if rv.endswith(suffix):
                word = word[:(- len(suffix))]
                r2 = r2[:(- len(suffix))]
                rv = rv[:(- len(suffix))]
                break
        for suffix in self.__adjectival_suffixes:
            if rv.endswith(suffix):
                if (suffix in (u'i^ushchi^ui^u', u'i^ushchi^ai^a', u'i^ushchui^u', u'i^ushchai^a', u'i^ushchoi^u', u'i^ushchei^u', u'i^ushchimi', u'i^ushchymi', u'i^ushchego', u'i^ushchogo', u'i^ushchemu', u'i^ushchomu', u'i^ushchikh', u'i^ushchykh', u'shchi^ui^u', u'shchi^ai^a', u'i^ushchee', u'i^ushchie', u'i^ushchye', u'i^ushchoe', u'i^ushchei`', u'i^ushchii`', u'i^ushchyi`', u'i^ushchoi`', u'i^ushchem', u'i^ushchim', u'i^ushchym', u'i^ushchom', u'vshi^ui^u', u'vshi^ai^a', u'shchui^u', u'shchai^a', u'shchoi^u', u'shchei^u', u'emi^ui^u', u'emi^ai^a', u'nni^ui^u', u'nni^ai^a', u'shchimi', u'shchymi', u'shchego', u'shchogo', u'shchemu', u'shchomu', u'shchikh', u'shchykh', u'vshui^u', u'vshai^a', u'vshoi^u', u'vshei^u', u'shchee', u'shchie', u'shchye', u'shchoe', u'shchei`', u'shchii`', u'shchyi`', u'shchoi`', u'shchem', u'shchim', u'shchym', u'shchom', u'vshimi', u'vshymi', u'vshego', u'vshogo', u'vshemu', u'vshomu', u'vshikh', u'vshykh', u'emui^u', u'emai^a', u'emoi^u', u'emei^u', u'nnui^u', u'nnai^a', u'nnoi^u', u'nnei^u', u'vshee', u'vshie', u'vshye', u'vshoe', u'vshei`', u'vshii`', u'vshyi`', u'vshoi`', u'vshem', u'vshim', u'vshym', u'vshom', u'emimi', u'emymi', u'emego', u'emogo', u'ememu', u'emomu', u'emikh', u'emykh', u'nnimi', u'nnymi', u'nnego', u'nnogo', u'nnemu', u'nnomu', u'nnikh', u'nnykh', u'emee', u'emie', u'emye', u'emoe', u'emei`', u'emii`', u'emyi`', u'emoi`', u'emem', u'emim', u'emym', u'emom', u'nnee', u'nnie', u'nnye', u'nnoe', u'nnei`', u'nnii`', u'nnyi`', u'nnoi`', u'nnem', u'nnim', u'nnym', u'nnom')):
                    if ((rv[((- len(suffix)) - 3):(- len(suffix))] == u'i^a') or (rv[((- len(suffix)) - 1):(- len(suffix))] == u'a')):
                        word = word[:(- len(suffix))]
                        r2 = r2[:(- len(suffix))]
                        rv = rv[:(- len(suffix))]
                        adjectival_removed = True
                        break
                else:
                    word = word[:(- len(suffix))]
                    r2 = r2[:(- len(suffix))]
                    rv = rv[:(- len(suffix))]
                    adjectival_removed = True
                    break
        if (not adjectival_removed):
            for suffix in self.__verb_suffixes:
                if rv.endswith(suffix):
                    if (suffix in (u'la', u'na', u'ete', u'i`te', u'li', u'i`', u'l', u'em', u'n', u'lo', u'no', u'et', u'i^ut', u'ny', u"t'", u"esh'", u'nno')):
                        if ((rv[((- len(suffix)) - 3):(- len(suffix))] == u'i^a') or (rv[((- len(suffix)) - 1):(- len(suffix))] == u'a')):
                            word = word[:(- len(suffix))]
                            r2 = r2[:(- len(suffix))]
                            rv = rv[:(- len(suffix))]
                            verb_removed = True
                            break
                    else:
                        word = word[:(- len(suffix))]
                        r2 = r2[:(- len(suffix))]
                        rv = rv[:(- len(suffix))]
                        verb_removed = True
                        break
        if ((not adjectival_removed) and (not verb_removed)):
            for suffix in self.__noun_suffixes:
                if rv.endswith(suffix):
                    word = word[:(- len(suffix))]
                    r2 = r2[:(- len(suffix))]
                    rv = rv[:(- len(suffix))]
                    break
    if rv.endswith(u'i'):
        word = word[:(-1)]
        r2 = r2[:(-1)]
    for suffix in self.__derivational_suffixes:
        if r2.endswith(suffix):
            word = word[:(- len(suffix))]
            break
    if word.endswith(u'nn'):
        word = word[:(-1)]
        undouble_success = True
    if (not undouble_success):
        for suffix in self.__superlative_suffixes:
            if word.endswith(suffix):
                word = word[:(- len(suffix))]
                superlative_removed = True
                break
        if word.endswith(u'nn'):
            word = word[:(-1)]
    if ((not undouble_success) and (not superlative_removed)):
        if word.endswith(u"'"):
            word = word[:(-1)]
    if chr_exceeded:
        word = self.__roman_to_cyrillic(word)
    return word
