Lower BinaryCompositions involving non-existent ContextFields to True.

    Args:
        present_locations: set of all locations in the current MatchQuery that have not been pruned
        expression: BinaryComposition with at least one ContextField operand

    Returns:
        TrueLiteral iff either ContextField operand is not in `present_locations`,
        and the original expression otherwise

def _update_context_field_binary_composition(present_locations, expression):
    """Lower BinaryCompositions involving non-existent ContextFields to True.

    Args:
        present_locations: set of all locations in the current MatchQuery that have not been pruned
        expression: BinaryComposition with at least one ContextField operand

    Returns:
        TrueLiteral iff either ContextField operand is not in `present_locations`,
        and the original expression otherwise
    """
    if not any((isinstance(expression.left, ContextField),
                isinstance(expression.right, ContextField))):
        raise AssertionError(u'Received a BinaryComposition {} without any ContextField '
                             u'operands. This should never happen.'.format(expression))

    if isinstance(expression.left, ContextField):
        context_field = expression.left
        location_name, _ = context_field.location.get_location_name()
        if location_name not in present_locations:
            return TrueLiteral

    if isinstance(expression.right, ContextField):
        context_field = expression.right
        location_name, _ = context_field.location.get_location_name()
        if location_name not in present_locations:
            return TrueLiteral

    return expression