def computed_values(d, *args, **kwargs):
 result = {}
 for (k, v) in six.iteritems(d):
  if callable(v):
   v = v(*args, **kwargs)
  if isinstance(v, dict):
   v = computed_values(v, *args, **kwargs)
  result[k] = v
 return result

def computed_values ( d , * args , ** kwargs ) : result = { } for ( k , v ) in six . iteritems ( d ) : if callable ( v ) : v = v ( * args , ** kwargs ) if isinstance ( v , dict ) : v = computed_values ( v , * args , ** kwargs ) result [ k ] = v return result
returns a new dict that has callable values replaced with the return values .