def update_hash(hasher, obj):
 hasher.update(str(type(obj)))
 if isinstance(obj, (tuple, list)):
  for e in obj:
   update_hash(hasher, e)
 elif isinstance(obj, dict):
  for k in sorted(obj):
   update_hash(hasher, k)
   update_hash(hasher, obj[k])
 else:
  hasher.update(repr(obj))

def update_hash ( hasher , obj ) : hasher . update ( str ( type ( obj ) ) ) if isinstance ( obj , ( tuple , list ) ) : for e in obj : update_hash ( hasher , e ) elif isinstance ( obj , dict ) : for k in sorted ( obj ) : update_hash ( hasher , k ) update_hash ( hasher , obj [ k ] ) else : hasher . update ( repr ( obj ) )
update a hashlib hasher with a nested object .