def write_merge_result(path, content): if len(content) > 0: tmp_path = path + '.temp' write_file_content(tmp_path, content) result = merge_xml([path, tmp_path]) write_file_content(path, result) os.remove(tmp_path)