#NEWLINE# def _normalize_char( self , char ) : #NEWLINE# #INDENT# "Normalize a character according to the LCD charset.\n\n        If the char exists in the charset, don't change it;\n        otherwise, normalize it to ascii.\n\n        Takes a unicode char, returns a unicode char.\n        " #NEWLINE# try : #NEWLINE# #INDENT# char . encode ( self . charset ) #NEWLINE# return self #NEWLINE# #UNINDENT# except UnicodeEncodeError : #NEWLINE# #INDENT# return unicodedata . normalize ( 'NFKD' , char ) . encode ( 'ascii' , 'ignore' ) . decode ( 'ascii' )