code: def algo_of_hash(h):
      
      try:
          enabled, algo = _HASH_ALGO_REVERSE_MAP[h.name]
      except KeyError:
          pass
      else:
          if not enabled:
              raise ValueError("support of {} in XMPP is forbidden".format(
                  algo
              ))
          return algo
  
      if h.name == "blake2b":
          return "blake2b-{}".format(h.digest_size * 8)
  
      raise ValueError(
          "unknown hash implementation: {!r}".format(h)
      )
docs: Return a :xep:`300` `algo` from a given :mod:`hashlib` hash.
  
      :param h: Hash object from :mod:`hashlib`.
      :raises ValueError: if `h` does not have a defined `algo` value.
      :raises ValueError: if the hash function MUST NOT be supported.
      :return: The `algo` value for the given hash.
      :rtype: :class:`str`
  
      .. warning::
  
          Use with caution for :func:`hashlib.blake2b` hashes.
          :func:`algo_of_hash` cannot safely determine whether blake2b was
          initialised with a salt, personality, key or other non-default
          :xep:`300` mode.
  
          In such a case, the return value will be the matching ``blake2b-*``
          `algo`, but the digest will not be compatible with the results of other
          implementations.