old_contents: def singleton(cls):
      instances = {}
  
      def getinstance():
          if cls not in instances:
              instances[cls] = cls()
          return instances[cls]
      return getinstance
  
new_contents: def to_singleton(cls):
      instances = {}
  
      def getinstance():
          if cls not in instances:
              instances[cls] = cls()
          return instances[cls]
      return getinstance
  
subject: Update singleton.py