def outConnectionLost(self):
        """
        EOF should only be sent when both STDOUT and STDERR have been closed.
        """
        if self.lostOutOrErrFlag:
            self.session.conn.sendEOF(self.session)
        else:
            self.lostOutOrErrFlag = True

        EOF should only be sent when both STDOUT and STDERR have been closed.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/conch/ssh/session.py