def _simplify_non_context_field_binary_composition(expression):
    """Return a simplified BinaryComposition if either operand is a TrueLiteral.

    Args:
        expression: BinaryComposition without any ContextField operand(s)

    Returns:
        simplified expression if the given expression is a disjunction/conjunction
        and one of it's operands is a TrueLiteral,
        and the original expression otherwise
    """
    if any((isinstance(expression.left, ContextField),
            isinstance(expression.right, ContextField))):
        raise AssertionError(u'Received a BinaryComposition {} with a ContextField '
                             u'operand. This should never happen.'.format(expression))

    if expression.operator == u'||':
        if expression.left == TrueLiteral or expression.right == TrueLiteral:
            return TrueLiteral
        else:
            return expression
    elif expression.operator == u'&&':
        if expression.left == TrueLiteral:
            return expression.right
        if expression.right == TrueLiteral:
            return expression.left
        else:
            return expression
    else:
        return expression
def _simplify_non_context_field_binary_composition ( expression ) : if any ( ( isinstance ( expression . left , ContextField ) , isinstance ( expression . right , ContextField ) ) ) : raise AssertionError ( u'Received a BinaryComposition {} with a ContextField ' u'operand. This should never happen.' . format ( expression ) ) if expression . operator == u'||' : if expression . left == TrueLiteral or expression . right == TrueLiteral : return TrueLiteral else : return expression elif expression . operator == u'&&' : if expression . left == TrueLiteral : return expression . right if expression . right == TrueLiteral : return expression . left else : return expression else : return expression
Return a simplified BinaryComposition if either operand is a TrueLiteral.

    Args:
        expression: BinaryComposition without any ContextField operand(s)

    Returns:
        simplified expression if the given expression is a disjunction/conjunction
        and one of it's operands is a TrueLiteral,
        and the original expression otherwise