title: Does ctypes provide anything for enums and flags?
body: <p>I have an API I'd like to use from python. That API contains flags and enums implemented with #define.</p>
  
  <pre><code>// it's just almost C so don't bother adding the typedef and parenthesis diarrhea here.
  routine(API_SOMETHING | API_OTHERTHING)
  stuff = getflags()
  ? stuff &amp; API_SOMETHING
  
  action(API_INTERESTING)
  mode = getaction()
  ? mode == INTERESTING
  </code></pre>
  
  <p>If ignoring everything else except enums and flags now, my bindings should translate this to:</p>
  
  <pre><code>routine(["something", "otherthing"])
  stuff = getflags()
  if 'something' in stuff
  
  action('interesting')
  mode = getaction()
  if mode == 'interesting'
  </code></pre>
  
  <p>Does ctypes provide mechanisms to do this straight out? If not then just tell about your 'usual' tool for handling flags and enums in python bindings.</p>