code: def dict_hash(dct):
      
      dct_s = json.dumps(dct, sort_keys=True)
  
      try:
          m = md5(dct_s)
      except TypeError:
          m = md5(dct_s.encode())
  
      return m.hexdigest()
docs: Return a hash of the contents of a dictionary