human
2 使用类(class)装饰器"
Please write code following the instructions in jupyter notebook style.
assistant
#Here is code to 2 使用类(class)装饰器 and the other steps required.

from functools import wraps
def singleton(cls):  
    instances = {}  
    @wraps(cls)  
    def wrapper(*args, **kwargs):  
        if cls not in instances:  
            instances[cls] = cls(*args, **kwargs)  
        return instances[cls]  
    return wrapper
@singleton  
class MyClass(object):  
    pass

myclass1 = MyClass()
myclass2 = MyClass()
print id(myclass1) == id(myclass2)