<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _handle_message(self, message, handle_wrte=True):
 """Handle a message that was read for this stream. For each message type, this means: OKAY: Check id's and make sure we are expecting an OKAY. Clear the self._expecting_okay flag so any pending write()'s know. CLSE: Set our internal state to closed. WRTE: Add the data read to our internal read buffer. Note we don't return the actual data because it may not be this thread that needs it. Args: message: Message that was read. handle_wrte: If True, we can handle WRTE messages, otherwise raise. Raises: AdbProtocolError: If we get a WRTE message but handle_wrte is False. """

    if message.command == 'OKAY':
      self._set_or_check_remote_id(message.arg0)
      if not self._expecting_okay:
        raise usb_exceptions.AdbProtocolError(
            '%s received unexpected OKAY: %s', self, message)
      self._expecting_okay = False
    elif message.command == 'CLSE':
      self.closed_state = self.ClosedState.CLOSED
    elif not handle_wrte:
      raise usb_exceptions.AdbProtocolError(
          '%s received WRTE before OKAY/CLSE: %s', self, message)
    else:
      with self._read_buffer_lock:
        self._read_buffer.append(message.data)
        self._buffer_size += len(message.data)