#NEWLINE# def write_pot_file( potfile , msgs ) : #NEWLINE# #INDENT# '\n    Write the :param potfile: POT file with the :param msgs: contents,\n    previously making sure its format is valid.\n    ' #NEWLINE# if os . path . exists ( fp ) : #NEWLINE# #INDENT# msgs = '\n' . join ( dropwhile ( len , msgs . split ( '\n' ) ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# msgs = msgs . replace ( 'charset=CHARSET' , 'charset=UTF-8' ) #NEWLINE# #UNINDENT# with io . open ( potfile , 'a' , encoding = 'utf-8' ) as fp : #NEWLINE# #INDENT# fp . write ( msgs )