def cleanse_setting(key, value):
 try:
  if HIDDEN_SETTINGS.search(key):
   cleansed = '********************'
  elif isinstance(value, dict):
   cleansed = dict(((k, cleanse_setting(k, v)) for (k, v) in value.items()))
  else:
   cleansed = value
 except TypeError:
  cleansed = value
 return cleansed

def cleanse_setting ( key , value ) : try : if HIDDEN_SETTINGS . search ( key ) : cleansed = '********************' elif isinstance ( value , dict ) : cleansed = dict ( ( ( k , cleanse_setting ( k , v ) ) for ( k , v ) in value . items ( ) ) ) else : cleansed = value except TypeError : cleansed = value return cleansed
cleanse an individual setting key/value of sensitive content .