code: def singleton(cls):
      instances = {}
  
      def getinstance():
          if cls not in instances:
              instances[cls] = cls()
          return instances[cls]
  
      return getinstance
  
imports: from collections import namedtuple
  from itertools import chain
  from six.moves import map, zip_longest
  from zipline.errors import ZiplineError
  from zipline.utils.compat import getargspec
label_desc: Use image node_id 1 for calling a global function with example usage: singleton(cls) and returns: getinstance, instances