code: def get_class_for_value(cls, value):
          
          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('%sChoiceAttribute' % type_.__name__.capitalize())
              # 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_]
docs: 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.