code: def sign(self, request, authheaders, response_body, secret):
          
          if "nonce" not in authheaders or authheaders["nonce"] == '':
              raise KeyError("nonce required in authorization headers.")
          if request.get_header('x-authorization-timestamp') == '':
              raise KeyError("X-Authorization-Timestamp is required.")
  
          try:
              mac = hmac.HMAC(base64.b64decode(secret.encode('utf-8'), validate=True), digestmod=self.digest)
          except TypeError:
              s = secret.encode('utf-8')
              if not re.match(b'^[A-Za-z0-9+/]*={0,2}$', s):
                  raise binascii.Error('Non-base64 digit found')
              mac = hmac.HMAC(base64.b64decode(s), digestmod=self.digest)
          mac.update(self.signable(request, authheaders, response_body).encode('utf-8'))
          digest = mac.digest()
          return base64.b64encode(digest).decode('utf-8')
docs: Returns the response signature for the response to the request.
  
          Keyword arguments:
          request -- A request object which can be consumed by this API.
          authheaders -- A string-indexable object which contains the headers appropriate for this signature version.
          response_body -- A string or bytes-like object which represents the body of the response.
          secret -- The base64-encoded secret key for the HMAC authorization.