code: def validate_one_touch_signature(self, signature, nonce, method, url, params):
          
          if not signature or not isinstance(signature, str):
              raise AuthyFormatException(
                  "Invalid signature - should not be empty. It is required")
  
          if not nonce:
              raise AuthyFormatException(
                  "Invalid nonce - should not be empty. It is required")
  
          if not method or not ('get' == method.lower() or 'post' == method.lower()):
              raise AuthyFormatException(
                  "Invalid method - should not be empty. It is required")
  
          if not params or not isinstance(params, dict):
              raise AuthyFormatException(
                  "Invalid params - should not be empty. It is required")
  
          query_params = self.__make_http_query(params)
          # Sort and replace encoded  params in case-sensitive order
          sorted_params = '&'.join(sorted(query_params.replace(
              '/', '%2F').replace('%20', '+').split('&')))
          sorted_params = re.sub("\\%5B([0-9])*\\%5D", "%5B%5D", sorted_params)
          sorted_params = re.sub("\\=None", "=", sorted_params)
          data = nonce + "|" + method + "|" + url + "|" + sorted_params
          try:
              calculated_signature = base64.b64encode(
                  hmac.new(self.api_key.encode(), data.encode(), hashlib.sha256).digest())
              return calculated_signature.decode() == signature
          except:
              calculated_signature = base64.b64encode(
                  hmac.new(self.api_key, data, hashlib.sha256).digest())
              return calculated_signature == signature
docs: Function to validate signature in X-Authy-Signature key of headers.
  
          :param string signature: X-Authy-Signature key of headers.
          :param string nonce: X-Authy-Signature-Nonce key of headers.
          :param string method: GET or POST - configured in app settings for OneTouch.
          :param string url: base callback url.
          :param dict params: params sent by Authy.
          :return bool: True if calculated signature and X-Authy-Signature are identical else False.