'Clean up any resources which may have been allocated for the given
reactor by its creation or by a test which used it.'

def unbuildReactor(self, reactor):

    reactor._uninstallHandler()
    if (getattr(reactor, '_internalReaders', None) is not None):
        for reader in reactor._internalReaders:
            reactor.removeReader(reader)
            reader.connectionLost(None)
        reactor._internalReaders.clear()
    reactor.disconnectAll()
    calls = reactor.getDelayedCalls()
    for c in calls:
        c.cancel()
