from enum import Enum

class {{ enum.class_info.name }}(str, Enum):
    {% for key, value in enum.values|dictsort(true) %}
    {{ key }} = "{{ value }}"
    {% endfor %}

    def __str__(self) -> str:
        return str(self.value)

    @classmethod
    def _missing_(cls, value: object) -> "{{ enum.class_info.name }} | None":
        if isinstance(value, str):
            upper_value = value.upper()
            for member in cls:
                if member.value.upper() == upper_value:
                    return member
        return None
