def strip_accents(s, encoding= 'utf-8'):
    """Strip characters with diacritics and return a flat ascii representation"""
    if sys.version < '3':
        if isinstance(s,unicode):
           return unicodedata.normalize('NFKD', s).encode('ASCII', 'ignore')
        else:
           return unicodedata.normalize('NFKD', unicode(s,encoding)).encode('ASCII', 'ignore')
    else:
        if isinstance(s,bytes): s = str(s,encoding)
        return str(unicodedata.normalize('NFKD', s).encode('ASCII', 'ignore'),'ascii')
def strip_accents ( s , encoding = 'utf-8' ) : if sys . version < '3' : if isinstance ( s , unicode ) : return unicodedata . normalize ( 'NFKD' , s ) . encode ( 'ASCII' , 'ignore' ) else : return unicodedata . normalize ( 'NFKD' , unicode ( s , encoding ) ) . encode ( 'ASCII' , 'ignore' ) else : if isinstance ( s , bytes ) : s = str ( s , encoding ) return str ( unicodedata . normalize ( 'NFKD' , s ) . encode ( 'ASCII' , 'ignore' ) , 'ascii' )
Strip characters with diacritics and return a flat ascii representation