def read(self):
    """Read a Response, do some validation, and return it."""
    if FLAGS.sc2_verbose_protocol:
      self._log(" Reading response ".center(60, "-"))
      start = time.time()
    response = self._read()
    if FLAGS.sc2_verbose_protocol:
      self._log(" %0.1f msec\n" % (1000 * (time.time() - start)))
      self._log_packet(response)
    if not response.HasField("status"):
      raise ProtocolError("Got an incomplete response without a status.")
    prev_status = self._status
    self._status = Status(response.status)  # pytype: disable=not-callable
    if response.error:
      err_str = ("Error in RPC response (likely a bug). "
                 "Prev status: %s, new status: %s, error:\n%s" % (
                     prev_status, self._status, "\n".join(response.error)))
      logging.error(err_str)
      raise ProtocolError(err_str)
    return response
Read a Response, do some validation, and return it.