title: Implementing Singleton as metaclass, but for abstract classes
body: <p>I have an abstract class and I would like to implement Singleton pattern for all classes that inherit from my abstract class. I know that my code won't work because there will be metaclass attribute conflict. Any ideas how to solve this?</p>
  
  <pre><code>from abc import ABCMeta, abstractmethod, abstractproperty
  
  class Singleton(type):
      _instances = {}
      def __call__(cls, *args, **kwargs):
          if cls not in cls._instances:
              cls._instances[cls] = super(Singleton, cls).__call__(*args, **kwargs)
          return cls._instances[cls]
  
  class GenericLogger(object):
      __metaclass__ = ABCMeta
  
      @abstractproperty
      def SearchLink(self): pass
  
  class Logger(GenericLogger):
      __metaclass__ = Singleton
  
      @property
      def SearchLink(self): return ''
  
  a = Logger()
  </code></pre>