@Override
    public void visitPyReferenceExpression(@NotNull PyReferenceExpression node) {
      final PyExceptPart exceptPart = PsiTreeUtil.getParentOfType(node, PyExceptPart.class);
      if (exceptPart != null) {
        final PyExpression exceptClass = exceptPart.getExceptClass();
        if (exceptClass != null && "ImportError".equals(exceptClass.getText())) return;
      }
      final PsiElement resolveResult = resolve(node);
      final PyFromImportStatement importStatement = PsiTreeUtil.getParentOfType(node, PyFromImportStatement.class);
      if (importStatement != null) {
        final PsiElement element = importStatement.resolveImportSource();
        if (resolveResult != null && element != resolveResult.getContainingFile()) return;
      }
      @NlsSafe String deprecationMessage = null;
      if (resolveResult instanceof PyDeprecatable deprecatable) {
        deprecationMessage = deprecatable.getDeprecationMessage();

        if (deprecationMessage == null && !(resolveResult.getContainingFile() instanceof PyiFile)) {
          PsiElement stub = PyiUtil.getPythonStub((PyElement)deprecatable);
          if (stub instanceof PyDeprecatable stubDeprecatable) {
            deprecationMessage = stubDeprecatable.getDeprecationMessage();
          }
        }
      }
      else if (resolveResult instanceof PyFile) {
        deprecationMessage = ((PyFile)resolveResult).getDeprecationMessage();
      }
      if (deprecationMessage != null) {
        ASTNode nameElement = node.getNameElement();
        registerProblem(nameElement == null ? node : nameElement.getPsi(), deprecationMessage, ProblemHighlightType.LIKE_DEPRECATED);
      }
    }
@Override
    public void visitPyReferenceExpression(@NotNull PyReferenceExpression node)