old_contents: """Enum related utilities."""
  from __future__ import annotations
  
  from enum import Enum
  from typing import Any
  
  
  class StrEnum(str, Enum):
      """Partial backport of Python 3.11's StrEnum for our basic use cases."""
  
      def __new__(cls, value: str, *args: Any, **kwargs: Any):  # type: ignore[no-untyped-def]
          """Create a new StrEnum instance."""
          if not isinstance(value, str):
              raise TypeError(f"{value!r} is not a string")
          return super().__new__(cls, value, *args, **kwargs)  # type: ignore[call-overload,no-any-return]
  
      def __str__(self) -> str:
          """Return self.value."""
          return str(self.value)
  
      @staticmethod
      def _generate_next_value_(  # pylint: disable=arguments-differ # https://github.com/PyCQA/pylint/issues/5371
          name: str, start: int, count: int, last_values: list[Any]
      ) -> Any:
          """
          Make `auto()` explicitly unsupported.
  
          We may revisit this when it's very clear that Python 3.11's
          `StrEnum.auto()` behavior will no longer change.
          """
          raise TypeError("auto() is not supported by this implementation")
  
new_contents: """Enum related utilities."""
  from __future__ import annotations
  
  from enum import Enum
  from typing import Any, TypeVar
  
  T = TypeVar("T", bound="StrEnum")
  
  
  class StrEnum(str, Enum):
      """Partial backport of Python 3.11's StrEnum for our basic use cases."""
  
      def __new__(cls: type[T], value: str, *args: Any, **kwargs: Any) -> T:
          """Create a new StrEnum instance."""
          if not isinstance(value, str):
              raise TypeError(f"{value!r} is not a string")
          return super().__new__(cls, value, *args, **kwargs)  # type: ignore[call-overload,no-any-return]
  
      def __str__(self) -> str:
          """Return self.value."""
          return str(self.value)
  
      @staticmethod
      def _generate_next_value_(  # pylint: disable=arguments-differ # https://github.com/PyCQA/pylint/issues/5371
          name: str, start: int, count: int, last_values: list[Any]
      ) -> Any:
          """
          Make `auto()` explicitly unsupported.
  
          We may revisit this when it's very clear that Python 3.11's
          `StrEnum.auto()` behavior will no longer change.
          """
          raise TypeError("auto() is not supported by this implementation")
  
subject: Add return type annotation to StrEnum (#60624)