human
Complete this python program:
def _comparator(func):
assistant
#Here is the Python code you requested.

    """Decorator for EnumValue rich comparison methods.
    """
    def comparator_wrapper(self, other):
        try:
            assert (self.enumtype == other.enumtype)
            result = func(self.index, other.index)
        except (AssertionError, AttributeError):
            result = NotImplemented
        return result
    comparator_wrapper.__name__ = func.__name__
    comparator_wrapper.__doc__ = getattr(float, func.__name__).__doc__
    return comparator_wrapper