def replace_all(text, terms):
 for (_from, _to) in terms.items():
  text = text.replace(_from, _to)
 return text

def replace_all ( text , terms ) : for ( _from , _to ) in terms . items ( ) : text = text . replace ( _from , _to ) return text
replaces all terms contained in a dict .