<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _writeData(self, command, device, params=()):
 """ Write the data to the device. :Parameters: command : `int` The command to write to the device. device : `int` The device is the integer number of the hardware devices ID and is only used with the Pololu Protocol. params : `tuple` Sequence of bytes to write. :Exceptions: * `SerialTimeoutException` If the low level serial package times out. * `SerialException` IO error when the port is not open. """

        sequence = []

        if self._compact:
            sequence.append(command | 0x80)
        else:
            sequence.append(self._BAUD_DETECT)
            sequence.append(device)
            sequence.append(command)

        for param in params:
            sequence.append(param)

        if self._crc:
            sequence.append(crc7(sequence))

        self._serial.write(bytearray(sequence))
        self._log and self._log.debug("Wrote byte sequence: %s",
                                      [hex(num) for num in sequence])