private void getReferences(PsiElement element) {
            if (element instanceof PyReferenceExpression ref && PsiTreeUtil.getParentOfType(element,
                                                                                            PyImportElement.class) == null) {
              if (remove_name.equals(PyPsiUtils.toPath(ref))) {  // filter out other names that might resolve to our target
                PsiElement resolved = ref.getReference().resolve();
                if (resolved == referee ||
                    resolved instanceof PyFunction && PyUtil.turnConstructorIntoClass((PyFunction)resolved) == referee) {
                  references.add(ref.getReference());
                }
              }
            }
          }
private void getReferences(PsiElement element)