def _replace_words(replacements, string):
output_lines = []<EOL>for line in string.split('<STR_LIT:\n>'):<EOL><INDENT>output_words = []<EOL>for word in line.split('<STR_LIT:U+0020>'):<EOL><INDENT>new_word = replacements.get(word, word)<EOL>output_words.append(new_word)<EOL><DEDENT>output_lines.append(output_words)<EOL><DEDENT>return '<STR_LIT:\n>'.join('<STR_LIT:U+0020>'.join(output_words) for output_words in output_lines)<EOL>
Replace words with corresponding values in replacements dict.

    Words must be separated by spaces or newlines.