def stubborn_cache (func):
    class aClass:
        def __init__(self):
            self.cache ={}
        def __call__(self, arg):
            try:
                value = self.cache[arg]
            except KeyError:
                value = func(arg)
                self.cache[arg] = value
            return value
    temp = aClass()
    return temp

@stubborn_cache
def happy(num):
    print ("I'm happy")
    return num+1

print (happy(1))
print (happy(1))

            
           