boolean (@NotNull final PsiFile file, int caretOffset) { final PsiElement element = file.findElementAt(caretOffset); return PsiTreeUtil.getParentOfType(element, PyStatementListContainer.class) != null; }