boolean (PsiReference reference, PyCustomMember member) { final PsiElement element = reference.resolve(); if (!(element instanceof MyInstanceElement)) { return false; } return ((MyInstanceElement)element).getThis().equals(member); }