private static boolean isClassLevelDefinitionInvisibleToReference(@NotNull PsiElement definition,
                                                                    @NotNull ScopeOwner definitionScope,
                                                                    @Nullable ScopeOwner referenceScope) {
    return definitionScope instanceof PyClass pyClass && pyClass != referenceScope && !(definition instanceof PyTypeParameter);
  }
private static boolean isClassLevelDefinitionInvisibleToReference(@NotNull PsiElement definition,
                                                                    @NotNull ScopeOwner definitionScope,
                                                                    @Nullable ScopeOwner referenceScope)