def salted_hmac(key_salt, value, secret=None):
if secret is None:<EOL><INDENT>secret = settings.SECRET_KEY<EOL><DEDENT>key_salt = force_bytes(key_salt)<EOL>secret = force_bytes(secret)<EOL>digest = hashes.Hash(<EOL>settings.CRYPTOGRAPHY_DIGEST, backend=settings.CRYPTOGRAPHY_BACKEND)<EOL>digest.update(key_salt + secret)<EOL>key = digest.finalize()<EOL>h = HMAC(<EOL>key,<EOL>settings.CRYPTOGRAPHY_DIGEST,<EOL>backend=settings.CRYPTOGRAPHY_BACKEND)<EOL>h.update(force_bytes(value))<EOL>return h<EOL>
Returns the HMAC-HASH of 'value', using a key generated from key_salt and a
secret (which defaults to settings.SECRET_KEY).

A different key_salt should be passed in for every application of HMAC.

:type key_salt: any
:type value: any
:type secret: any
:rtype: HMAC