def returnthisclassfrom(methods):
    '''
    Class decorator by Alex Martelli.

    see ('http://stackoverflow.com/questions/1242589/
          subclassing-int-to-attain-a-hex-representation/1243045#1243045)
    '''
    def wrapit(cls, method):
        return lambda *a: cls(method(*a))
    def dowrap(cls):
        for n in methods:
          method = getattr(cls, n)
          setattr(cls, n, wrapit(cls, method))
        return cls

    return dowrap

    Class decorator by Alex Martelli.

    see ('http://stackoverflow.com/questions/1242589/
          subclassing-int-to-attain-a-hex-representation/1243045#1243045)
    
recipes/Python/577640_Romnumeral_class_overloaded_int/recipe-577640.py