code: def setup():
      
      global _displayhooks, _excepthooks
      if _displayhooks is not None:
          return
  
      _displayhooks = []
      _excepthooks = []
  
      # store any current hooks
      if sys.displayhook != sys.__displayhook__:
          _displayhooks.append(weakref.ref(sys.displayhook))
  
      if sys.excepthook != sys.__excepthook__:
          _excepthooks.append(weakref.ref(sys.excepthook))
  
      # replace the current hooks
      sys.displayhook = displayhook
      sys.excepthook = excepthook
docs: Initializes the hook queues for the sys module.  This method will
      automatically be called on the first registration for a hook to the system
      by either the registerDisplay or registerExcept functions.