code: def create_signature(secret, value, digestmod='sha256', encoding='utf-8'):
      
      if isinstance(secret, str):
          secret = secret.encode(encoding)
  
      if isinstance(value, str):
          value = value.encode(encoding)
  
      if isinstance(digestmod, str):
          digestmod = getattr(hashlib, digestmod, hashlib.sha1)
  
      hm = hmac.new(secret, digestmod=digestmod)
      hm.update(value)
      return hm.hexdigest()
docs: Create HMAC Signature from secret for value.