'Convert a parsed filter expression into a dict of
filters (S3ResourceQueries)
@param expression: the parsed filter expression (ParseResults)
@returns: a dict of {component_alias: filter_query}'

def convert_expression(self, expression):

    ParseResults = self.ParseResults
    convert = self.convert_expression
    if isinstance(expression, ParseResults):
        (first, op, second) = ([None, None, None] + list(expression))[(-3):]
        if isinstance(first, ParseResults):
            first = convert(first)
        if isinstance(second, ParseResults):
            second = convert(second)
        if (op == 'not'):
            return self._not(second)
        elif (op == 'and'):
            return self._and(first, second)
        elif (op == 'or'):
            return self._or(first, second)
        elif (op in S3ResourceQuery.COMPARISON):
            return self._query(op, first, second)
        elif ((op in S3FieldSelector.OPERATORS) and second):
            selector = S3FieldSelector(second)
            selector.op = op
            return selector
        elif ((op is None) and second):
            return S3FieldSelector(second)
    else:
        return None
