def defdict_to_dict(defdict, constructor=dict):
 if isinstance(defdict, dict):
  new = constructor()
  for (key, value) in defdict.items():
   new[key] = defdict_to_dict(value, constructor)
  return new
 else:
  return defdict

def defdict_to_dict ( defdict , constructor = dict ) : if isinstance ( defdict , dict ) : new = constructor ( ) for ( key , value ) in defdict . items ( ) : new [ key ] = defdict_to_dict ( value , constructor ) return new else : return defdict
recursively convert default dicts to regular dicts .