code: public static PyExpr maybeProtect(PyExpr expr, int minSafePrecedence) {
      // all python operators are left associative, so if this has equivalent precedence we don't need
      // to wrap
      if (expr.getPrecedence() >= minSafePrecedence) {
        return expr;
      } else {
        return new PyExpr("(" + expr.getText() + ")", Integer.MAX_VALUE);
      }
    }
docs: Wraps an expression with parenthesis if it's not above the minimum safe precedence.
  
  <p>NOTE: For the sake of brevity, this implementation loses typing information in the
  expressions.
  
  @param expr The expression to wrap.
  @param minSafePrecedence The minimum safe precedence (not inclusive).
  @return The PyExpr potentially wrapped in parenthesis.