def errReceived(self, data):
        """
        Report an error.

        @param data: Data to include in L{Failure}.
        @type data: L{bytes}
        """
        self.transport.loseConnection()
        if self.proto is not None:
            self.proto.connectionLost(failure.Failure(UnexpectedOutputError(data)))
            self.proto = None

        Report an error.

        @param data: Data to include in L{Failure}.
        @type data: L{bytes}
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/conch/stdio.py