PsiElement (@NotNull ASTNode node) { final PyStatementPart statementPart = PsiTreeUtil.getParentOfType(node.getPsi(), PyStatementPart.class, false, PyStatementList.class); if (statementPart != null) { return statementPart; } final PyWithItem withItem = PsiTreeUtil.getParentOfType(node.getPsi(), PyWithItem.class); if (withItem != null) { return withItem.getParent(); } return null; }