def get_response(self):
        """
        gets the message type and message from rexster

        :returns: RexProMessage
        """
        msg_version = self.recv(1)
        if not msg_version:
            raise exceptions.RexProConnectionException('socket connection has been closed')
        if bytearray([msg_version])[0] != 1:
            raise exceptions.RexProConnectionException('unsupported protocol version: {}'.format())

        serializer_type = self.recv(1)
        if bytearray(serializer_type)[0] != 0:
            raise exceptions.RexProConnectionException('unsupported serializer version: {}'.format())

        #get padding
        self.recv(4)

        msg_type = self.recv(1)
        msg_type = bytearray(msg_type)[0]

        msg_len = struct.unpack('!I', self.recv(4))[0]

        response = ''
        while len(response) < msg_len:
            response += self.recv(msg_len)

        MessageTypes = messages.MessageTypes

        type_map = {
            MessageTypes.ERROR: messages.ErrorResponse,
            MessageTypes.SESSION_RESPONSE: messages.SessionResponse,
            MessageTypes.SCRIPT_RESPONSE: messages.MsgPackScriptResponse
        }

        if msg_type not in type_map:
            raise exceptions.RexProConnectionException("can't deserialize message type {}".format(msg_type))
        return type_map[msg_type].deserialize(response)
dataset/ETHPy150Open bdeggleston/rexpro-python/rexpro/connection.py/RexProSocket.get_response/original