See <Singleton> design pattern for detail: http://www.oodesign.com/singleton-pattern.html
    Python <Singleton> reference: http://stackoverflow.com/questions/6760685/creating-a-singleton-in-python
    Recommend use Singleton as a metaclass

    Usage:
        @singleton
        class MyClass(object):
            pass

def singleton(cls):
    """
    See <Singleton> design pattern for detail: http://www.oodesign.com/singleton-pattern.html
    Python <Singleton> reference: http://stackoverflow.com/questions/6760685/creating-a-singleton-in-python
    Recommend use Singleton as a metaclass

    Usage:
        @singleton
        class MyClass(object):
            pass
    """
    instances = {}

    def get_instance(*args, **kwargs):
        if cls not in instances:
            instances[cls] = cls(*args, **kwargs)
        return instances[cls]
    return get_instance