code: private PyExpr genTernaryConditional(PyExpr conditionalExpr, PyExpr trueExpr, PyExpr falseExpr) {
      // Python's ternary operator switches the order from <conditional> ? <true> : <false> to
      // <true> if <conditional> else <false>.
      int conditionalPrecedence = PyExprUtils.pyPrecedenceForOperator(Operator.CONDITIONAL);
      StringBuilder exprSb =
          new StringBuilder()
              .append(PyExprUtils.maybeProtect(trueExpr, conditionalPrecedence).getText())
              .append(" if ")
              .append(PyExprUtils.maybeProtect(conditionalExpr, conditionalPrecedence).getText())
              .append(" else ")
              .append(PyExprUtils.maybeProtect(falseExpr, conditionalPrecedence).getText());
  
      return new PyExpr(exprSb.toString(), conditionalPrecedence);
    }
docs: Generates a ternary conditional Python expression given the conditional and true/false
  expressions.
  
  @param conditionalExpr the conditional expression
  @param trueExpr the expression to execute if the conditional executes to true
  @param falseExpr the expression to execute if the conditional executes to false
  @return a ternary conditional expression