def __dict_replace(s, d):
 for (key, value) in d.items():
  s = s.replace(key, value)
 return s

def __dict_replace ( s , d ) : for ( key , value ) in d . items ( ) : s = s . replace ( key , value ) return s
replace substrings of a string using a dictionary .