'Recursively parse the query structure.'

def _process_filter(self, query, backend_state):

    if (not query):
        return True
    cmd = query[0]
    method = self.commands[cmd]
    cooked_args = []
    for arg in query[1:]:
        if isinstance(arg, list):
            arg = self._process_filter(arg, backend_state)
        elif isinstance(arg, six.string_types):
            arg = self._parse_string(arg, backend_state)
        if (arg is not None):
            cooked_args.append(arg)
    result = method(self, cooked_args)
    return result
