docs: @Override
    protected void visitIfNode(IfNode node) {
      // Create another instance of this visitor for generating Python expressions from children.
      GenPyExprsVisitor genPyExprsVisitor =
          genPyExprsVisitorFactory.create(localVarExprs, errorReporter);
      TranslateToPyExprVisitor translator =
          new TranslateToPyExprVisitor(localVarExprs, pluginValueFactory, errorReporter);
  
      StringBuilder pyExprTextSb = new StringBuilder();
  
      boolean hasElse = false;
      // We need to be careful about parenthesizing the sub-expressions in a python ternary operator,
      // as nested ternary operators will right-associate. Due to the structure of the parse tree,
      // we accumulate open parens in the loop below, and pendingParens tracks how many closing parens
      // we need to add at the end.
      int pendingParens = 0;
      for (SoyNode child : node.getChildren()) {
  
        if (child instanceof IfCondNode) {
          IfCondNode icn = (IfCondNode) child;
  
          // Python ternary conditional expressions modify the order of the conditional from
          // <conditional> ? <true> : <false> to
          // <true> if <conditional> else <false>
          PyExpr condBlock = PyExprUtils.concatPyExprs(genPyExprsVisitor.exec(icn)).toPyString();
          condBlock =
              PyExprUtils.maybeProtect(
                  condBlock, PyExprUtils.pyPrecedenceForOperator(Operator.CONDITIONAL));
          pyExprTextSb.append("(").append(condBlock.getText());
  
          // Append the conditional and if/else syntax.
          PyExpr condPyExpr = translator.exec(icn.getExpr());
          pyExprTextSb.append(") if (").append(condPyExpr.getText()).append(") else (");
          pendingParens++;
  
        } else if (child instanceof IfElseNode) {
          hasElse = true;
          IfElseNode ien = (IfElseNode) child;
  
          PyExpr elseBlock = PyExprUtils.concatPyExprs(genPyExprsVisitor.exec(ien)).toPyString();
          pyExprTextSb.append(elseBlock.getText()).append(")");
          pendingParens--;
        } else {
          throw new AssertionError("Unexpected if child node type. Child: " + child);
        }
      }
  
      if (!hasElse) {
        pyExprTextSb.append("''");
      }
      for (int i = 0; i < pendingParens; i++) {
        pyExprTextSb.append(")");
      }
  
      // By their nature, inline'd conditionals can only contain output strings, so they can be
      // treated as a string type with a conditional precedence.
      pyExprs.add(
          new PyStringExpr(
              pyExprTextSb.toString(), PyExprUtils.pyPrecedenceForOperator(Operator.CONDITIONAL)));
    }