def __new__(mcs, *args):
        enum = super(EnumType, mcs).__new__(mcs, *args)
        attributes = [k_v for k_v in list(enum.__dict__.items()) if k_v[0].isupper()]
        labels = enum.__dict__.get('labels', {})

        enum.values = {}
        for attribute in attributes:
            enum.values[attribute[1]] = enum.Value(attribute[0], attribute[1], labels.get(attribute[1]), enum)
        return enum
Create enum values from all uppercase class attributes and store them in a dict on the Enum class.
dataset/ETHPy150Open 5monkeys/django-enumfield/django_enumfield/enum.py/EnumType.__new__