title: String-based enum in Python
body: <p>To encapsulate a list of states I am using <code>enum</code> module: </p>
  
  <pre><code>from enum import Enum
  
  class MyEnum(Enum):
      state1='state1'
      state2 = 'state2'
  
  state = MyEnum.state1
  MyEnum['state1'] == state  # here it works
  'state1' == state  # here it does not throw but returns False (fail!)
  </code></pre>
  
  <p>However, the issue is that I need to seamlessly use the values as strings in many contexts in my script, like:</p>
  
  <pre><code>select_query1 = select(...).where(Process.status == str(MyEnum.state1))  # works but ugly
  
  select_query2 = select(...).where(Process.status == MyEnum.state1)  # throws exeption
  </code></pre>
  
  <p>How to do it avoiding calling additional type conversion (<code>str(state)</code> above) or the underlying value (<code>state.value</code>)?</p>