code: def parse_response(self, request):
          
  
          if request == -1:
              return self.parse_connection_setup()
  
          # Parse ordinary server response
          gotreq = 0
          while 1:
              if self.data_recv:
                  # Check the first byte to find out what kind of response it is
                  rtype = byte2int(self.data_recv)
  
              # Are we're waiting for additional data for the current packet?
              if self.recv_packet_len:
                  if len(self.data_recv) < self.recv_packet_len:
                      return gotreq
  
                  if rtype == 1:
                      gotreq = self.parse_request_response(request) or gotreq
                      continue
                  elif rtype & 0x7f == ge.GenericEventCode:
                      self.parse_event_response(rtype)
                      continue
                  else:
                      raise AssertionError(rtype)
  
              # Every response is at least 32 bytes long, so don't bother
              # until we have received that much
              if len(self.data_recv) < 32:
                  return gotreq
  
              # Error response
              if rtype == 0:
                  gotreq = self.parse_error_response(request) or gotreq
  
              # Request response or generic event.
              elif rtype == 1 or rtype & 0x7f == ge.GenericEventCode:
                  # Set reply length, and loop around to see if
                  # we have got the full response
                  rlen = int(struct.unpack('=L', self.data_recv[4:8])[0])
                  self.recv_packet_len = 32 + rlen * 4
  
              # Else non-generic event
              else:
                  self.parse_event_response(rtype)
docs: Internal method.
  
          Parse data received from server.  If REQUEST is not None
          true is returned if the request with that serial number
          was received, otherwise false is returned.
  
          If REQUEST is -1, we're parsing the server connection setup
          response.