String (@NotNull final PsiElement element) { final PyStringLiteralExpression stringLiteralExpression = PsiTreeUtil.getParentOfType(element, PyStringLiteralExpression.class); if (stringLiteralExpression != null) { final String text = stringLiteralExpression.getText(); final Pair<String,String> quotes = PyStringLiteralCoreUtil.getQuotes(text); final PyDocStringOwner docStringOwner = PsiTreeUtil.getParentOfType(stringLiteralExpression, PyDocStringOwner.class); if (docStringOwner != null && stringLiteralExpression.equals(docStringOwner.getDocStringExpression())) { String indent = getIndent(stringLiteralExpression); if (quotes != null) { final List<String> strings = StringUtil.split(text, "\n"); if (strings.get(0).trim().equals(quotes.getFirst())) { return quotes.getFirst() + indent; } else { final String value = stringLiteralExpression.getStringValue(); final int firstNotSpace = StringUtil.findFirst(value, CharFilter.NOT_WHITESPACE_FILTER); return quotes.getFirst() + value.substring(0, firstNotSpace); } } return "\"" + indent; } else return quotes != null? quotes.getFirst() : "\""; } return element instanceof PsiComment? "# " : ""; }