<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, message):
 """ Coroutine that writes the next packet. """

        try:
            self.socket.send(message.encode('utf-8') + b'\0')
        except socket.error:
            if not self._closed:
                raise BrokenPipeError

        return Future.succeed(None)