String (@Nullable String defaultValue, boolean parameterRenderedAsTyped) { if (defaultValue == null) return null; final StringBuilder sb = new StringBuilder(); // According to PEP 8 equal sign should be surrounded by spaces if annotation is present sb.append(parameterRenderedAsTyped ? " = " : "="); final Pair<String, String> quotes = PyStringLiteralCoreUtil.getQuotes(defaultValue); if (quotes != null) { final String value = defaultValue.substring(quotes.getFirst().length(), defaultValue.length() - quotes.getSecond().length()); sb.append(quotes.getFirst()); StringUtil.escapeStringCharacters(value.length(), value, sb); sb.append(quotes.getSecond()); } else { sb.append(defaultValue); } return sb.toString(); }