Parses the raw message from the device.

        :param data: message data to parse
        :type data: string

        :raises: :py:class:`~alarmdecoder.util.InvalidMessageError`

def _parse_message(self, data):
        """
        Parses the raw message from the device.

        :param data: message data to parse
        :type data: string

        :raises: :py:class:`~alarmdecoder.util.InvalidMessageError`
        """
        try:
            _, values = data.split(':')
            values = values.split(',')

            # Handle older-format events
            if len(values) <= 3:
                self.event_data, self.partition, self.event_type = values
                self.version = 1

            # Newer-format events
            else:
                self.event_data, self.partition, self.event_type, self.report_code = values
                self.version = 2

                event_type_data = self.event_type.split('_')
                self.event_prefix = event_type_data[0]                      # Ex: CID
                self.event_source = get_event_source(self.event_prefix)     # Ex: LRR_EVENT_TYPE.CID
                self.event_status = int(event_type_data[1][0])              # Ex: 1 or 3
                self.event_code = int(event_type_data[1][1:], 16)           # Ex: 0x100 = Medical

                # replace last 2 digits of event_code with report_code, if applicable.
                if not self.skip_report_override and self.report_code not in ['00', 'ff']:
                    self.event_code = int(event_type_data[1][1] + self.report_code, 16)
                self.event_description = get_event_description(self.event_source, self.event_code)

        except ValueError:
            raise InvalidMessageError('Received invalid message: {0}'.format(data))