PsiElement (@NotNull PyClass pyClass) { final PyStatement firstStatement = pyClass.getStatementList().getStatements()[0]; final PyStringLiteralExpression classDocstring = pyClass.getDocStringExpression(); if (firstStatement instanceof PyExpressionStatement && classDocstring == ((PyExpressionStatement)firstStatement).getExpression()) { return firstStatement; } return null; }