String (String name, PsiElement psiElement) { PyClass containingClass = PsiTreeUtil.getParentOfType(psiElement, PyClass.class); if (containingClass == null) { return null; } if (containingClass.findInstanceAttribute(name, true) != null) { return PyPsiBundle.message("refactoring.introduce.constant.scope.error"); } return null; }