PsiElement (PsiElement exitStatement) { if (exitStatement instanceof PyReturnStatement) { return PsiTreeUtil.getParentOfType(exitStatement, PyFunction.class); } else if (exitStatement instanceof PyBreakStatement) { return ((PyBreakStatement)exitStatement).getLoopStatement(); } else if (exitStatement instanceof PyContinueStatement) { return ((PyContinueStatement)exitStatement).getLoopStatement(); } else if (exitStatement instanceof PyRaiseStatement) { // TODO[oleg]: Implement better logic here! return null; } return null; }