#NEWLINE# def deaccent( text ) : #NEWLINE# #INDENT# '\n    Remove accentuation from the given string. Input text is either a unicode string or utf8\n    encoded bytestring.\n    ' #NEWLINE# if ( not isinstance ( text , unicode ) ) : #NEWLINE# #INDENT# text = text . decode ( 'utf8' ) #NEWLINE# #UNINDENT# norm = unicodedata . normalize ( 'NFD' , text ) #NEWLINE# result = u ( '' ) . join ( ( ch for ch in norm if ( unicodedata . category ( ch ) != 'Mn' ) ) ) #NEWLINE# return unicodedata . normalize ( 'NFC' , result )