def get_stable_hash(obj):
 if isinstance(obj, dict):
  return get_stable_hash(list(obj.items()))
 elif isinstance(obj, (list, tuple)):
  obj = sorted((get_stable_hash(o) for o in obj))
 return md5(unicode(obj).encode('utf8')).hexdigest()

def get_stable_hash ( obj ) : if isinstance ( obj , dict ) : return get_stable_hash ( list ( obj . items ( ) ) ) elif isinstance ( obj , ( list , tuple ) ) : obj = sorted ( ( get_stable_hash ( o ) for o in obj ) ) return md5 ( unicode ( obj ) . encode ( 'utf8' ) ) . hexdigest ( )
return a stable hash for a python data structure .