def operator_same_class(method):
    """
    Intended to wrap operator methods, this decorator ensures the `other`
    parameter is of the same type as the `self` parameter.
    
    :param method: The method being decorated.
    :return: The wrapper to replace the method with.
    """
    def wrapper(self, other):
        if not isinstance(other, self.__class__):
            raise TypeError(
                'unsupported operand types: \'{0}\' and \'{1}\''.format(
                    self.__class__.__name__, other.__class__.__name__))
        return method(self, other)
    return wrapper
Intended to wrap operator methods, this decorator ensures the `other`
    parameter is of the same type as the `self` parameter.
    
    :param method: The method being decorated.
    :return: The wrapper to replace the method with.