title: How to pickle complex enum values in Python
body: <p>When I try to unpickle pickled complex enum instance, I always get "ValueError: BLUE is not a valid Colors".</p>
  
  <p>Is there any way how to pickle and unpickle?</p>
  
  <pre><code>from pickle import loads, dumps
  from enum import Enum
  
  
  class ColorType(object):
  
      def __init__(self, counter, name):
          self.counter = counter
          self.name = name
  
      def __str__(self):
          return self.name
  
  
  class Colors(Enum):
      GREEN = ColorType(1, 'GREEN')
      BLUE = ColorType(2, 'BLUE')
  
  
  color = Colors.BLUE
  print(color is loads(dumps(color)))
  </code></pre>
  
  <p>I am using Python 2.7.</p>