boolean (Object element, PsiElement context) { if (!(element instanceof PsiElement)) { return false; } final PsiFile containingFile = ((PsiElement)element).getContainingFile(); return containingFile instanceof PyFile && ((PyFile)containingFile).getLanguageLevel().isAtLeast(myLevel); }