def _SendCommand(self, command_sequence, reply_length=0):
    buf_out = bytearray(command_sequence)
    with self._lock:
        self._serial.write(buf_out)
        if (reply_length > 0):
            buf_in = bytearray(self._serial.read(reply_length))
            assert (len(buf_in) == reply_length)
        else:
            buf_in = None
    return buf_in
def _SendCommand(self, command_sequence, reply_length=0):
    buf_out = bytearray(command_sequence)
    with self._lock:
        self._serial.write(buf_out)
        if (reply_length > 0):
            buf_in = bytearray(self._serial.read(reply_length))
            assert (len(buf_in) == reply_length)
        else:
            buf_in = None
    return buf_in