def __new__(cls, name, bases, attrs):
        super_new = super(CategoryMetaclass, cls).__new__
        parents = [
            b for b in bases if isinstance(b, CategoryMetaclass) and
            not (b.__name__ == 'NewBase' and b.__mro__ == (b, object))
        ]
        if not parents:
            return super_new(cls, name, bases, attrs)

        # Create the class.
        new_cls = super_new(cls, name, bases, attrs)

        # validation
        if not hasattr(new_cls, 'name'):
            raise ImproperlyConfigured('No name attribute defined in %s.' % new_cls)

        if not hasattr(new_cls, 'slug'):
            raise ImproperlyConfigured('No slug attribute defined in %s.' % new_cls)

        if not hasattr(new_cls, 'dashboard'):
            raise ImproperlyConfigured('No dashboard attribute defined in %s.' % new_cls)

        if not re.match('^[\w-]+$', new_cls.slug):
            raise ImproperlyConfigured('The slug attribute defined in %s contains invalid chars.' % new_cls)

        return new_cls
dataset/ETHPy150Open django-bmf/django-bmf/djangobmf/core/category.py/CategoryMetaclass.__new__/original