boolean (@NotNull PyClass cls, @NotNull PyClass metaClass, @NotNull TypeEvalContext context) { final String metaClassName = metaClass.getName(); if (metaClassName == null) return false; final PyType metaClassType = cls.getMetaClassType(false, context); if (metaClassType != null) return false; insertImport(cls, metaClass); final LanguageLevel languageLevel = LanguageLevel.forElement(cls); if (languageLevel.isPython2()) { addClassAttributeIfNotExist(cls, PyNames.DUNDER_METACLASS, metaClassName); } else { final List<Pair<String, String>> keywordArguments = Collections.singletonList(Pair.create(PyNames.METACLASS, metaClassName)); addSuperClassExpressions(cls.getProject(), cls, null, keywordArguments); } return true; }