<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def translate_query_params(cls, **kwargs):
 """ Translate an arbirtary keyword argument to the expected query. TODO: refactor this into something less insane. XXX: Clean this up. It's *too* flexible. In the v2 API, many endpoints expect a particular query argument to be in the form of `query=xxx` where `xxx` would be the name of perhaps the name, ID or otherwise. This function ought to take a more aptly named parameter specified in `TRANSLATE_QUERY_PARAM`, and substitute it into the `query` keyword argument. The purpose is so that some models (optionally) have nicer named keyword arguments than `query` for easier to read python. If a query argument is given then the output should be that value. If a substitute value is given as a keyword specified in `TRANSLATE_QUERY_PARAM`(and query is not) then the `query` argument will be that keyword argument. Eg. No query param TRANSLATE_QUERY_PARAM = ('name',) kwargs = {'name': 'PagerDuty',} output = {'query': 'PagerDuty'} or, query param explicitly TRANSLATE_QUERY_PARAM = ('name',) kwargs = {'name': 'PagerDuty', 'query': 'XXXXPlopperDuty'} output = {'query': 'XXXXPlopperDuty'} or, TRANSLATE_QUERY_PARAM is None TRANSLATE_QUERY_PARAM = None kwargs = {'name': 'PagerDuty', 'query': 'XXXXPlopperDuty'} output = {'output': 'XXXXPlopperDuty', 'name': 'PagerDuty'} """

        values = []
        output = kwargs.copy()
        query = kwargs.pop('query', None)

        # remove any of the TRANSLATE_QUERY_PARAMs in output
        for param in (cls.TRANSLATE_QUERY_PARAM or []):
            popped = output.pop(param, None)
            if popped is not None:
                values.append(popped)

        # if query is provided, just use it
        if query is not None:
            output['query'] = query
            return output

        # if query is not provided, use the first parameter we removed from
        # the kwargs
        try:
            output['query'] = next(iter(values))
        except StopIteration:
            pass

        return output