@Nullable
  @Override
  public PyType getMetaClassType(@NotNull TypeEvalContext context) {
    PyPsiUtils.assertValid(this);
    if (context.maySwitchToAST(this)) {
      final PyExpression expression = getMetaClassExpression();
      if (expression != null) {
        final PyType type = context.getType(expression);
        if (type != null) {
          return type;
        }
      }
    }
    else {
      final QualifiedName name = getMetaClassQName();
      final PsiFile file = getContainingFile();
      if (file instanceof PyFile pyFile) {
        if (name != null) {
          return classTypeFromQName(name, pyFile, context);
        }
      }
    }
    final LanguageLevel level = LanguageLevel.forElement(this);
    if (level.isPython2()) {
      final PsiFile file = getContainingFile();
      if (file instanceof PyFile pyFile) {
        final PsiElement element = pyFile.getElementNamed(PyNames.DUNDER_METACLASS);
        if (element instanceof PyTypedElement) {
          return context.getType((PyTypedElement)element);
        }
      }
    }
    return null;
  }
@Nullable
  @Override
  public PyType getMetaClassType(@NotNull TypeEvalContext context)