import threading


class SingletonMixin(object):
    __singleton_lock = threading.Lock()
    __singleton_instance = None

    @classmethod
    def instance(cls, *args, **kwargs):
        if not cls.__singleton_instance:
            with cls.__singleton_lock:
                if not cls.__singleton_instance:
                    cls.__singleton_instance = cls(*args, **kwargs)
        return cls.__singleton_instance


@@ -69,24 +69,12 @@
 k = 
-threading.Lock()
+None
 %0A   
@@ -120,16 +120,16 @@
 smethod%0A
-
     def 
@@ -160,16 +160,106 @@
 wargs):%0A
+        if not cls.__singleton_lock:%0A            cls.__singleton_lock = threading.Lock()%0A%0A
         

Change singletons to instantiate locks per-class