code: def _comparator(func):
      
      def comparator_wrapper(self, other):
          try:
              # [PATCH] The code was originally the following:
              #
              #     assert self.enumtype == other.enumtype
              #     result = func(self.index, other.index)
              #
              # which first statement causes an issue when serializing/unserializing object
              # from/to memcached using pylibmc, which built a new instance of the
              # enumeration.  Therefore two items are stated different while semantically
              # the same.
              #
              # These two lines are replaced by the following, which relies on the fact that
              # developers are not likely naming two items of distinct enumerations the same
              # way, and less likely to compare two items of two distinct enumerations.
              #
              # (Daniel CAUNE; daniel.caune@gmail.com; 2012-05-11)
              result = func(self.key, other.key)
          except (AssertionError, AttributeError):
              result = NotImplemented
  
          return result
      comparator_wrapper.__name__ = func.__name__
      comparator_wrapper.__doc__ = getattr(float, func.__name__).__doc__
      return comparator_wrapper
docs: Decorator for EnumValue rich comparison methods.