<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def write(self, data):
 """Write ``data`` into the wire. Returns an empty tuple or a :class:`~asyncio.Future` if this protocol has paused writing. """

        if self.closed:
            raise ConnectionResetError(
                'Transport closed - cannot write on %s' % self
            )
        else:
            t = self.transport
            if self._paused or self._buffer:
                self._buffer.appendleft(data)
                self._buffer_size += len(data)
                self._write_from_buffer()
                if self._buffer_size > 2 * self._b_limit:
                    if self._waiter and not self._waiter.cancelled():
                        self.logger.warning(
                            '%s buffer size is %d: limit is %d ',
                            self._buffer_size, self._b_limit
                        )
                    else:
                        t.pause_reading()
                        self._waiter = self._loop.create_future()
            else:
                t.write(data)
            self.changed()
            return self._waiter