private static boolean isApplicableInInsertionContext(@NotNull PyElement definition,
                                                        @NotNull QualifiedName fqn, @NotNull PsiElement position,
                                                        @NotNull TypeEvalContext context) {
    if (PyTypingTypeProvider.isInsideTypeHint(position, context)) {
      // Not all names from typing.py are defined as classes
      return definition instanceof PyClass || ArrayUtil.contains(fqn.getFirstComponent(), "typing", "typing_extensions");
    }
    if (PsiTreeUtil.getParentOfType(position, PyPattern.class, false) != null) {
      return definition instanceof PyClass;
    }
    return true;
  }
private static boolean isApplicableInInsertionContext(@NotNull PyElement definition,
                                                        @NotNull QualifiedName fqn, @NotNull PsiElement position,
                                                        @NotNull TypeEvalContext context)