def _process_send_string(self, data):
        """
        Send data from a string to the remote socket.
        """
        try:
            bytes_sent = self._socket_send(data)
        except socket.error as err:
            self._safely_call(self.on_write_error, err)
            return 0

        if len(data) > bytes_sent:
            self._send_buffer.insert(0, (Stream.SEND_STRING, data[bytes_sent:]))

        return bytes_sent
dataset/ETHPy150Open ecdavis/pants/pants/stream.py/Stream._process_send_string/original