def connectionLost(self, reason):
        """
        Fail the waiting Deferred, initialized by C{waitForDescriptor}, if there
        is one.
        """
        ConnectableProtocol.connectionLost(self, reason)
        if self.waiting is not None:
            self.waiting.errback(reason)
            self.waiting = None
        self.reason = reason

        Fail the waiting Deferred, initialized by C{waitForDescriptor}, if there
        is one.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/test/test_unix.py