def register(self, name, class_=None):
        """
        Accepts a ``name`` and ``class_``, a class object that must extend
        ``base``. The class is added to the registry.::

            named_registry.register("My Class", MyClass)

        If no ``class_`` is provided. A class decorator (callable) is returned
        that is bound to the given ``name`` and accepts one arguement,
        ``_class``. This allows for the following use of the register method::

            @named_registry.register("My Class")
            class MyClass:
                pass

        The exception ``appregister.base.AlreadyRegistered`` is raised if the
        class has already been registered, as defined by the ``is_registered``
        method.

        The exception ``appregister.base.InvalidOperation`` is raised if the
        class is not a valid addition to this register, as defined by the
        ``is_valid`` method.
        """

        if self.is_registered(name):
            msg = class_.__name__ % "Object '%s' has already been registered"
            raise AlreadyRegistered(msg)

        # If only name is provided, return a callable that accepts only the
        # class instance, this adds support for decorator registration on named
        # registries.
        if not class_:
            def inner(class_):
                return self.register(name, class_)
            return inner

        if not self.is_valid(class_):
            msg = "Object '%s' is not a subclass of '%s'" % (class_.__name__,
                self.base.__name__)
            raise InvalidOperation(msg)

        self._registry[name] = class_

        # Return the original class to allow this method to be used as a
        # class based decorator.
        return class_
dataset/ETHPy150Open d0ugal-archive/django-appregister/appregister/base.py/NamedRegistry.register/swapped operands of `%`