TextRange (@NotNull ASTNode element, @NotNull TextRange range) { PsiElement psiElement = element.getPsi(); if (psiElement == null) return range; if (!psiElement.getLanguage().is(PythonLanguage.getInstance())) return range; PyPsiUtils.assertValid(psiElement); PsiFile file = psiElement.isValid() ? psiElement.getContainingFile() : null; if (file == null) return range; return new PyCommentFormatter(file).process(psiElement, range); }