def singleton(cls, *args, **kw):
    instance = {}
    def _singleton():
        if cls not in instance:
            instance[cls] = cls(*args, **kw)
        return instance[cls]
    return _singleton
Make Class Single
dataset/ETHPy150Open bufferx/twork/twork/utils/common.py/singleton