Construct a mapping from local fields to specified operators, and corresponding expressions.

    Args:
        expression_list: list of expressions to analyze

    Returns:
        local_field_to_expressions:
            dict mapping local field names to "operator -> list of BinaryComposition" dictionaries,
            for each BinaryComposition operator involving the LocalField
        remaining_expression_list:
            list of remaining expressions that were *not*
            BinaryCompositions on a LocalField using any of the between operators

def _construct_field_operator_expression_dict(expression_list):
    """Construct a mapping from local fields to specified operators, and corresponding expressions.

    Args:
        expression_list: list of expressions to analyze

    Returns:
        local_field_to_expressions:
            dict mapping local field names to "operator -> list of BinaryComposition" dictionaries,
            for each BinaryComposition operator involving the LocalField
        remaining_expression_list:
            list of remaining expressions that were *not*
            BinaryCompositions on a LocalField using any of the between operators
    """
    between_operators = (u'<=', u'>=')
    inverse_operator = {u'>=': u'<=', u'<=': u'>='}
    local_field_to_expressions = {}
    remaining_expression_list = deque([])
    for expression in expression_list:
        if all((
            isinstance(expression, BinaryComposition),
            expression.operator in between_operators,
            isinstance(expression.left, LocalField) or isinstance(expression.right, LocalField)
        )):
            if isinstance(expression.right, LocalField):
                new_operator = inverse_operator[expression.operator]
                new_expression = BinaryComposition(new_operator, expression.right, expression.left)
            else:
                new_expression = expression
            field_name = new_expression.left.field_name
            expressions_dict = local_field_to_expressions.setdefault(field_name, {})
            expressions_dict.setdefault(new_expression.operator, []).append(new_expression)
        else:
            remaining_expression_list.append(expression)
    return local_field_to_expressions, remaining_expression_list