old_contents: class Singleton(type):
      
      def __init__(self, name, bases, namespace):
          super().__init__(name, bases, namespace)
          self.instance = None
  
      def __call__(self, *args, **kwargs):
          if self.instance is None:
              self.instance = super().__call__(*args, **kwargs)
          return self.instance
              
  
new_contents: """
  
  Singleton
  =========
  
  Metaclass to make a class a singleton.
  
  Use as::
  
      class MySingleton(object, metaclass=Singleton): ...
  
  """
  
  class Singleton(type):
      
      def __init__(self, name, bases, namespace):
          super().__init__(name, bases, namespace)
          self.instance = None
  
      def __call__(self, *args, **kwargs):
          if self.instance is None:
              self.instance = super().__call__(*args, **kwargs)
          return self.instance
              
  
subject: Add comment to singleton module