PyExpression () { ASTNode[] children = getNode().getChildren(null); boolean foundAs = false; for (ASTNode child : children) { if (child.getElementType() == PyTokenTypes.AS_KEYWORD) { foundAs = true; } else if (foundAs && child.getPsi() instanceof PyExpression) { return (PyExpression) child.getPsi(); } } return null; }