def freezedicts(obj):
 if isinstance(obj, (list, tuple)):
  return type(obj)([freezedicts(sub) for sub in obj])
 if isinstance(obj, dict):
  return frozenset(six.iteritems(obj))
 return obj

def freezedicts ( obj ) : if isinstance ( obj , ( list , tuple ) ) : return type ( obj ) ( [ freezedicts ( sub ) for sub in obj ] ) if isinstance ( obj , dict ) : return frozenset ( six . iteritems ( obj ) ) return obj
recursively iterate over obj .