code: def validate(self, uri, params, signature):
          
          if params is None:
              params = {}
  
          parsed_uri = urlparse(uri)
          if parsed_uri.scheme == "https" and parsed_uri.port:
              uri = remove_port(parsed_uri)
  
          valid_signature = False  # Default fail
          valid_body_hash = True  # May not receive body hash, so default succeed
  
          query = parse_qs(parsed_uri.query)
          if "bodySHA256" in query and isinstance(params, string_types):
              valid_body_hash = compare(self.compute_hash(params), query["bodySHA256"][0])
              valid_signature = compare(self.compute_signature(uri, {}), signature)
          else:
              valid_signature = compare(self.compute_signature(uri, params), signature)
  
          return valid_signature and valid_body_hash
docs: Validate a request from Twilio
  
          :param uri: full URI that Twilio requested on your server
          :param params: dictionary of POST variables or string of POST body for JSON requests
          :param signature: expected signature in HTTP X-Twilio-Signature header
  
          :returns: True if the request passes validation, False if not