'Stem a Finnish 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):

    word = word.lower()
    if (word in self.stopwords):
        return word
    step3_success = False
    (r1, r2) = self._r1r2_standard(word, self.__vowels)
    for suffix in self.__step1_suffixes:
        if r1.endswith(suffix):
            if (suffix == u'sti'):
                if (suffix in r2):
                    word = word[:(-3)]
                    r1 = r1[:(-3)]
                    r2 = r2[:(-3)]
            elif (word[((- len(suffix)) - 1)] in u'ntaeiouy\xe4\xf6'):
                word = word[:(- len(suffix))]
                r1 = r1[:(- len(suffix))]
                r2 = r2[:(- len(suffix))]
            break
    for suffix in self.__step2_suffixes:
        if r1.endswith(suffix):
            if (suffix == u'si'):
                if (word[(-3)] != u'k'):
                    word = word[:(-2)]
                    r1 = r1[:(-2)]
                    r2 = r2[:(-2)]
            elif (suffix == u'ni'):
                word = word[:(-2)]
                r1 = r1[:(-2)]
                r2 = r2[:(-2)]
                if word.endswith(u'kse'):
                    word = suffix_replace(word, u'kse', u'ksi')
                if r1.endswith(u'kse'):
                    r1 = suffix_replace(r1, u'kse', u'ksi')
                if r2.endswith(u'kse'):
                    r2 = suffix_replace(r2, u'kse', u'ksi')
            elif (suffix == u'an'):
                if ((word[(-4):(-2)] in (u'ta', u'na')) or (word[(-5):(-2)] in (u'ssa', u'sta', u'lla', u'lta'))):
                    word = word[:(-2)]
                    r1 = r1[:(-2)]
                    r2 = r2[:(-2)]
            elif (suffix == u'\xe4n'):
                if ((word[(-4):(-2)] in (u't\xe4', u'n\xe4')) or (word[(-5):(-2)] in (u'ss\xe4', u'st\xe4', u'll\xe4', u'lt\xe4'))):
                    word = word[:(-2)]
                    r1 = r1[:(-2)]
                    r2 = r2[:(-2)]
            elif (suffix == u'en'):
                if (word[(-5):(-2)] in (u'lle', u'ine')):
                    word = word[:(-2)]
                    r1 = r1[:(-2)]
                    r2 = r2[:(-2)]
            else:
                word = word[:(-3)]
                r1 = r1[:(-3)]
                r2 = r2[:(-3)]
            break
    for suffix in self.__step3_suffixes:
        if r1.endswith(suffix):
            if (suffix in (u'han', u'hen', u'hin', u'hon', u'h\xe4n', u'h\xf6n')):
                if (((suffix == u'han') and (word[(-4)] == u'a')) or ((suffix == u'hen') and (word[(-4)] == u'e')) or ((suffix == u'hin') and (word[(-4)] == u'i')) or ((suffix == u'hon') and (word[(-4)] == u'o')) or ((suffix == u'h\xe4n') and (word[(-4)] == u'\xe4')) or ((suffix == u'h\xf6n') and (word[(-4)] == u'\xf6'))):
                    word = word[:(-3)]
                    r1 = r1[:(-3)]
                    r2 = r2[:(-3)]
                    step3_success = True
            elif (suffix in (u'siin', u'den', u'tten')):
                if ((word[((- len(suffix)) - 1)] == u'i') and (word[((- len(suffix)) - 2)] in self.__restricted_vowels)):
                    word = word[:(- len(suffix))]
                    r1 = r1[:(- len(suffix))]
                    r2 = r2[:(- len(suffix))]
                    step3_success = True
                else:
                    continue
            elif (suffix == u'seen'):
                if (word[(-6):(-4)] in self.__long_vowels):
                    word = word[:(-4)]
                    r1 = r1[:(-4)]
                    r2 = r2[:(-4)]
                    step3_success = True
                else:
                    continue
            elif (suffix in (u'a', u'\xe4')):
                if ((word[(-2)] in self.__vowels) and (word[(-3)] in self.__consonants)):
                    word = word[:(-1)]
                    r1 = r1[:(-1)]
                    r2 = r2[:(-1)]
                    step3_success = True
            elif (suffix in (u'tta', u'tt\xe4')):
                if (word[(-4)] == u'e'):
                    word = word[:(-3)]
                    r1 = r1[:(-3)]
                    r2 = r2[:(-3)]
                    step3_success = True
            elif (suffix == u'n'):
                word = word[:(-1)]
                r1 = r1[:(-1)]
                r2 = r2[:(-1)]
                step3_success = True
                if ((word[(-2):] == u'ie') or (word[(-2):] in self.__long_vowels)):
                    word = word[:(-1)]
                    r1 = r1[:(-1)]
                    r2 = r2[:(-1)]
            else:
                word = word[:(- len(suffix))]
                r1 = r1[:(- len(suffix))]
                r2 = r2[:(- len(suffix))]
                step3_success = True
            break
    for suffix in self.__step4_suffixes:
        if r2.endswith(suffix):
            if (suffix in (u'mpi', u'mpa', u'mp\xe4', u'mmi', u'mma', u'mm\xe4')):
                if (word[(-5):(-3)] != u'po'):
                    word = word[:(-3)]
                    r1 = r1[:(-3)]
                    r2 = r2[:(-3)]
            else:
                word = word[:(- len(suffix))]
                r1 = r1[:(- len(suffix))]
                r2 = r2[:(- len(suffix))]
            break
    if (step3_success and (len(r1) >= 1) and (r1[(-1)] in u'ij')):
        word = word[:(-1)]
        r1 = r1[:(-1)]
    elif ((not step3_success) and (len(r1) >= 2) and (r1[(-1)] == u't') and (r1[(-2)] in self.__vowels)):
        word = word[:(-1)]
        r1 = r1[:(-1)]
        r2 = r2[:(-1)]
        if r2.endswith(u'imma'):
            word = word[:(-4)]
            r1 = r1[:(-4)]
        elif (r2.endswith(u'mma') and (r2[(-5):(-3)] != u'po')):
            word = word[:(-3)]
            r1 = r1[:(-3)]
    if (r1[(-2):] in self.__long_vowels):
        word = word[:(-1)]
        r1 = r1[:(-1)]
    if ((len(r1) >= 2) and (r1[(-2)] in self.__consonants) and (r1[(-1)] in u'a\xe4ei')):
        word = word[:(-1)]
        r1 = r1[:(-1)]
    if r1.endswith((u'oj', u'uj')):
        word = word[:(-1)]
        r1 = r1[:(-1)]
    if r1.endswith(u'jo'):
        word = word[:(-1)]
        r1 = r1[:(-1)]
    for i in range(1, len(word)):
        if (word[(- i)] in self.__vowels):
            continue
        else:
            if (i == 1):
                if (word[((- i) - 1):] in self.__double_consonants):
                    word = word[:(-1)]
            elif (word[((- i) - 1):((- i) + 1)] in self.__double_consonants):
                word = u''.join((word[:(- i)], word[((- i) + 1):]))
            break
    return word
