'Stem an Italian 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
    step1_success = False
    word = word.replace(u'\xe1', u'\xe0').replace(u'\xe9', u'\xe8').replace(u'\xed', u'\xec').replace(u'\xf3', u'\xf2').replace(u'\xfa', u'\xf9')
    for i in range(1, len(word)):
        if ((word[(i - 1)] == u'q') and (word[i] == u'u')):
            word = u''.join((word[:i], u'U', word[(i + 1):]))
    for i in range(1, (len(word) - 1)):
        if ((word[(i - 1)] in self.__vowels) and (word[(i + 1)] in self.__vowels)):
            if (word[i] == u'u'):
                word = u''.join((word[:i], u'U', word[(i + 1):]))
            elif (word[i] == u'i'):
                word = u''.join((word[:i], u'I', word[(i + 1):]))
    (r1, r2) = self._r1r2_standard(word, self.__vowels)
    rv = self._rv_standard(word, self.__vowels)
    for suffix in self.__step0_suffixes:
        if rv.endswith(suffix):
            if (rv[((- len(suffix)) - 4):(- len(suffix))] in (u'ando', u'endo')):
                word = word[:(- len(suffix))]
                r1 = r1[:(- len(suffix))]
                r2 = r2[:(- len(suffix))]
                rv = rv[:(- len(suffix))]
            elif (rv[((- len(suffix)) - 2):(- len(suffix))] in (u'ar', u'er', u'ir')):
                word = suffix_replace(word, suffix, u'e')
                r1 = suffix_replace(r1, suffix, u'e')
                r2 = suffix_replace(r2, suffix, u'e')
                rv = suffix_replace(rv, suffix, u'e')
            break
    for suffix in self.__step1_suffixes:
        if word.endswith(suffix):
            if ((suffix == u'amente') and r1.endswith(suffix)):
                step1_success = True
                word = word[:(-6)]
                r2 = r2[:(-6)]
                rv = rv[:(-6)]
                if r2.endswith(u'iv'):
                    word = word[:(-2)]
                    r2 = r2[:(-2)]
                    rv = rv[:(-2)]
                    if r2.endswith(u'at'):
                        word = word[:(-2)]
                        rv = rv[:(-2)]
                elif r2.endswith((u'os', u'ic')):
                    word = word[:(-2)]
                    rv = rv[:(-2)]
                elif r2.endswith(u'abil'):
                    word = word[:(-4)]
                    rv = rv[:(-4)]
            elif ((suffix in (u'amento', u'amenti', u'imento', u'imenti')) and rv.endswith(suffix)):
                step1_success = True
                word = word[:(-6)]
                rv = rv[:(-6)]
            elif r2.endswith(suffix):
                step1_success = True
                if (suffix in (u'azione', u'azioni', u'atore', u'atori')):
                    word = word[:(- len(suffix))]
                    r2 = r2[:(- len(suffix))]
                    rv = rv[:(- len(suffix))]
                    if r2.endswith(u'ic'):
                        word = word[:(-2)]
                        rv = rv[:(-2)]
                elif (suffix in (u'logia', u'logie')):
                    word = word[:(-2)]
                    rv = word[:(-2)]
                elif (suffix in (u'uzione', u'uzioni', u'usione', u'usioni')):
                    word = word[:(-5)]
                    rv = rv[:(-5)]
                elif (suffix in (u'enza', u'enze')):
                    word = suffix_replace(word, suffix, u'te')
                    rv = suffix_replace(rv, suffix, u'te')
                elif (suffix == u'it\xe0'):
                    word = word[:(-3)]
                    r2 = r2[:(-3)]
                    rv = rv[:(-3)]
                    if r2.endswith((u'ic', u'iv')):
                        word = word[:(-2)]
                        rv = rv[:(-2)]
                    elif r2.endswith(u'abil'):
                        word = word[:(-4)]
                        rv = rv[:(-4)]
                elif (suffix in (u'ivo', u'ivi', u'iva', u'ive')):
                    word = word[:(-3)]
                    r2 = r2[:(-3)]
                    rv = rv[:(-3)]
                    if r2.endswith(u'at'):
                        word = word[:(-2)]
                        r2 = r2[:(-2)]
                        rv = rv[:(-2)]
                        if r2.endswith(u'ic'):
                            word = word[:(-2)]
                            rv = rv[:(-2)]
                else:
                    word = word[:(- len(suffix))]
                    rv = rv[:(- len(suffix))]
            break
    if (not step1_success):
        for suffix in self.__step2_suffixes:
            if rv.endswith(suffix):
                word = word[:(- len(suffix))]
                rv = rv[:(- len(suffix))]
                break
    if rv.endswith((u'a', u'e', u'i', u'o', u'\xe0', u'\xe8', u'\xec', u'\xf2')):
        word = word[:(-1)]
        rv = rv[:(-1)]
        if rv.endswith(u'i'):
            word = word[:(-1)]
            rv = rv[:(-1)]
    if rv.endswith((u'ch', u'gh')):
        word = word[:(-1)]
    word = word.replace(u'I', u'i').replace(u'U', u'u')
    return word
