<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def setup():
 """ 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. """

    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