String (@NotNull String prevText, @NotNull TextRange range, String newContent) { final String newText = range.replace(prevText, newContent); if (PyStringLiteralCoreUtil.isQuoted(newText)) { return newText; } final Pair<String, String> quotes = calculateQuotes(prevText); return quotes.first + newText + quotes.second; }