def hmac_digest(secret, message, encoding='utf-8'):
 if isinstance(secret, six.text_type):
  secret = secret.encode(encoding)
 return hmac.new(secret, message.encode(encoding), hashlib.sha256).hexdigest()

def hmac_digest ( secret , message , encoding = 'utf-8' ) : if isinstance ( secret , six . text_type ) : secret = secret . encode ( encoding ) return hmac . new ( secret , message . encode ( encoding ) , hashlib . sha256 ) . hexdigest ( )
return hex digest of a message hmac using secret .