def reparam(string_, dictionary):
 dictionary = dictionary.copy()
 result = []
 for (live, chunk) in _interpolate(string_):
  if live:
   v = eval(chunk, dictionary)
   result.append(sqlquote(v))
  else:
   result.append(chunk)
 return SQLQuery.join(result, '')

def reparam ( string_ , dictionary ) : dictionary = dictionary . copy ( ) result = [ ] for ( live , chunk ) in _interpolate ( string_ ) : if live : v = eval ( chunk , dictionary ) result . append ( sqlquote ( v ) ) else : result . append ( chunk ) return SQLQuery . join ( result , '' )
takes a string and a dictionary and interpolates the string using values from the dictionary .