Ref<PyType> (@NotNull PsiElement element, @NotNull TypeEvalContext context) { if (element instanceof PyTypedElement) { final PyType type = context.getType((PyTypedElement)element); if (type instanceof PyClassLikeType classType) { if (classType.isDefinition()) { final PyType instanceType = classType.toInstance(); return Ref.create(instanceType); } } else if (type instanceof PyNoneType) { return Ref.create(type); } } return null; }