Easiest way to replace a string using a dictionary of replacements?,pattern = re.compile('|'.join(list(d.keys())))