def write_file(filename, text):
logging.debug(_('<STR_LIT>'), filename)<EOL>try:<EOL><INDENT>with open(filename, '<STR_LIT:w>') as writable:<EOL><INDENT>writable.write(text)<EOL><DEDENT><DEDENT>except (PermissionError, NotADirectoryError):<EOL><INDENT>logging.error(_('<STR_LIT>'), filename)<EOL>return False<EOL><DEDENT>return True<EOL>
Write text to a file.