
def singleton(cls):
    #Decorador para patron singleton

    instances = dict()

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

        return instances[cls]

    return wrap