<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _set_or_check_remote_id(self, remote_id):
 """Set or check the remote id."""

    if not self.remote_id:
      assert self.closed_state == self.ClosedState.PENDING, 'Bad ClosedState!'
      self.remote_id = remote_id
      self.closed_state = self.ClosedState.OPEN
    elif self.remote_id != remote_id:
      raise usb_exceptions.AdbProtocolError(
          '%s remote-id change to %s', self, remote_id)