Checks if the message parameters are valid.
        Assumes that the types are already correct.

        :raises ValueError: iff one or more attributes are invalid

def _check(self):
        """Checks if the message parameters are valid.
        Assumes that the types are already correct.

        :raises ValueError: iff one or more attributes are invalid
        """

        if self.timestamp < 0.0:
            raise ValueError("the timestamp may not be negative")
        if isinf(self.timestamp):
            raise ValueError("the timestamp may not be infinite")
        if isnan(self.timestamp):
            raise ValueError("the timestamp may not be NaN")

        if self.is_remote_frame and self.is_error_frame:
            raise ValueError("a message cannot be a remote and an error frame at the sane time")

        if self.arbitration_id < 0:
            raise ValueError("arbitration IDs may not be negative")

        if self.is_extended_id:
            if 0x20000000 <= self.arbitration_id:
                raise ValueError("Extended arbitration IDs must be less than 2^29")
        elif 0x800 <= self.arbitration_id:
            raise ValueError("Normal arbitration IDs must be less than 2^11")

        if self.dlc < 0:
            raise ValueError("DLC may not be negative")
        if self.is_fd:
            if 64 < self.dlc:
                raise ValueError("DLC was {} but it should be <= 64 for CAN FD frames".format(self.dlc))
        elif 8 < self.dlc:
            raise ValueError("DLC was {} but it should be <= 8 for normal CAN frames".format(self.dlc))

        if self.is_remote_frame:
            if self.data is not None and len(self.data) != 0:
                raise ValueError("remote frames may not carry any data")
        elif self.dlc != len(self.data):
            raise ValueError("the DLC and the length of the data must match up for non remote frames")

        if not self.is_fd:
            if self.bitrate_switch:
                raise ValueError("bitrate switch is only allowed for CAN FD frames")
            if self.error_state_indicator:
                raise ValueError("error state indicator is only allowed for CAN FD frames")