def loseConnection(self):
        """
        Close the channel if there is no buferred data.  Otherwise, note the
        request and return.
        """
        self.closing = 1
        if not self.buf and not self.extBuf:
            self.conn.sendClose(self)

        Close the channel if there is no buferred data.  Otherwise, note the
        request and return.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/conch/ssh/channel.py