private String toTernaryTermExpression(Field field, TypeReference fieldType, TernaryTerm ternaryTerm, List<Argument> parserArguments,
                                              List<Argument> serializerArguments, boolean serialize, Tracer tracer) {
        tracer = tracer.dive("ternary term instanceOf");
        if ("if".equals(ternaryTerm.getOperation())) {
            // Ternary operation is "if", so we can build an inline if statement
            Term a = ternaryTerm.getA();
            Term b = ternaryTerm.getB();
            Term c = ternaryTerm.getC();
            String castExpressionForTypeReference = getCastExpressionForTypeReference(fieldType);
            String inlineIf = toExpression(field, fieldType, b, parserArguments, serializerArguments, serialize, false) + " if " +
                toExpression(field, new DefaultBooleanTypeReference(), a, parserArguments, serializerArguments, serialize, false) +
                " else " +
                toExpression(field, fieldType, c, parserArguments, serializerArguments, serialize, false);

            return tracer + inlineIf;
        } else {
            throw new FreemarkerException("Unsupported ternary operation type " + ternaryTerm.getOperation());
        }
    }
Returns a Python expression that represents the given ternary term.

@param field the field of the given type reference
@param fieldType the type reference of the given data
@param ternaryTerm the ternary term to represent
@param parserArguments the parser arguments
@param serializerArguments the serializer arguments
@param serialize whether the data is serialized
@param tracer the tracer to use
@return a Python expression
code-generation/language-python/src/main/java/org/apache/plc4x/language/python/PythonLanguageTemplateHelper.java