def generate_secured_api_key(self, private_api_key, queryParameters,
                                 user_token=''):
        """
        Generate a secured and public API Key from a dict of query parameters and an
        optional user token identifying the current user.

        @param private_api_key your private API Key
        @param queryParameters the dict of query parameters applied to the query (used as security)
        @param user_token an optional token identifying the current user
        """
        if isinstance(queryParameters, (list, tuple)): #List of tags
            queryParameters = ','.join(
                    map(lambda t: ''.join(['(', ','.join(t), ')']) if
                        isinstance(t, (list, tuple)) else t, queryParameters))
            queryParameters = {'tagFilters': queryParameters}
        elif not isinstance(queryParameters, dict) and not '=' in queryParameters: #TagFilter
            queryParameters = {'tagFilters': queryParameters}

        if isinstance(queryParameters, dict): #New API Key generator
            if user_token != None and user_token != '':
                queryParameters['userToken'] = user_token
            queryParameters = urlencode(urlify(queryParameters))

        securedKey = hmac.new(private_api_key.encode('utf-8'), queryParameters.encode('utf-8'), hashlib.sha256).hexdigest()
        return str(base64.b64encode(((securedKey, queryParameters) % "%s%s").encode('utf-8')).decode('utf-8'))
dataset/ETHPy150Open algolia/algoliasearch-client-python/algoliasearch/client.py/Client.generate_secured_api_key/swapped operands of `%`