multi_replace

sage.misc.multireplace.multiple_replace(dict, text)

Replace in ‘text’ all occurrences of any key in the given dictionary by its corresponding value. Returns the new string.