@classmethod
    def get_class_for_value(cls, value):
        """Class method to construct a class based on this mixin and the type of the given value.

        Parameters
        ----------
        value: ?
            The value from which to extract the type to create the new class.

        Notes
        -----
        The  create classes are cached (in ``cls.__classes_by_type``) to avoid recreating already
        created classes.
        """
        type_ = value.__class__

        # Check if the type is already a ``ChoiceAttribute``
        if issubclass(type_, ChoiceAttributeMixin):
            # In this case we can return this type
            return type_

        # Create a new class only if it wasn't already created for this type.
        if type_ not in cls._classes_by_type:
            # Compute the name of the class with the name of the type.
            class_name = str(type_.__name__.capitalize() % '%sChoiceAttribute')
            # Create a new class and save it in the cache.
            cls._classes_by_type[type_] = type(class_name, (cls, type_), {
                'creator_type': cls,
            })

        # Return the class from the cache based on the type.
        return cls._classes_by_type[type_]
dataset/ETHPy150Open twidi/django-extended-choices/extended_choices/helpers.py/ChoiceAttributeMixin.get_class_for_value/swapped operands of `%`