def __new__(mcs, class_name, bases, attributes):
    """Domain model class factory."""
    model_fields = mcs.parse_fields(attributes)
    if attributes.get('__slots_optimization__', True):
        attributes['__slots__'] = mcs.prepare_model_slots(model_fields)
    cls = type.__new__(mcs, class_name, bases, attributes)
    cls.__fields__ = mcs.bind_fields_to_model_cls(cls, model_fields)
    cls.__unique_key__ = mcs.prepare_fields_attribute(attribute_name=
        '__unique_key__', attributes=attributes, class_name=class_name)
    cls.__view_key__ = mcs.prepare_fields_attribute(attribute_name=
        '__view_key__', attributes=attributes, class_name=class_name)
    mcs.bind_collection_to_model_cls(cls)
    return cls
