def checkDisconnected(self, kind=None):
        """
        Helper function to check if the transport disconnected.
        """
        if kind is None:
            kind = transport.DISCONNECT_PROTOCOL_ERROR
        self.assertEqual(self.packets[-1][0], transport.MSG_DISCONNECT)
        self.assertEqual(self.packets[-1][1][3:4], chr(kind))

        Helper function to check if the transport disconnected.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/conch/test/test_transport.py