<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _writer_thread_proc(self, is_raw):
 """Write as long as the stream is not closed."""

    # If we're not in raw mode, do line-buffered reads to play nicer with
    # potential interactive uses, max of MAX_ADB_DATA, since anything we write
    # to the stream will get packetized to that size anyway.
    #
    # Loop until our stream gets closed, which will cause one of these
    # operations to raise.  Since we're in a separate thread, it'll just get
    # ignored, which is what we want.
    reader = self.stdin.read if is_raw else self.stdin.readline
    while not self.stream.is_closed():
      self.stream.write(reader(adb_protocol.MAX_ADB_DATA))