def substitute_variables(input_data, substitutions):
 def f(value):
  if (not isinstance(value, basestring)):
   return value
  new_value = Template(value).safe_substitute(substitutions)
  if (new_value != value):
   LOG.debug(('Substituted %s -> %s' % (repr(value), repr(new_value))))
  return new_value
 return recursive_walk(f, input_data)

def substitute_variables ( input_data , substitutions ) : def f ( value ) : if ( not isinstance ( value , basestring ) ) : return value new_value = Template ( value ) . safe_substitute ( substitutions ) if ( new_value != value ) : LOG . debug ( ( 'Substituted %s -> %s' % ( repr ( value ) , repr ( new_value ) ) ) ) return new_value return recursive_walk ( f , input_data )
replaces variables with values from substitutions .