<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _command_sender(self):
 """ Command sender. """

        sequence = -1

        while True:
            cmd = self._queue.get()

            ipaddr = cmd["target"]
            payloadtype = cmd["payloadtype"]

            if "sequence" not in cmd:
                # get next sequence number if we haven't got one
                sequence = (sequence + 1) % SEQUENCE_COUNT
                cmd["sequence"] = sequence + SEQUENCE_BASE

            packet = None

            if payloadtype == PayloadType.SETCOLOR:
                packet = self._gen_packet_setcolor(cmd["sequence"],
                                                   cmd["hue"],
                                                   cmd["sat"],
                                                   cmd["bri"],
                                                   cmd["kel"],
                                                   cmd["fade"])

            elif payloadtype == PayloadType.SETPOWER2:
                packet = self._gen_packet_setpower(cmd["sequence"],
                                                   cmd["power"],
                                                   cmd["fade"])

            elif payloadtype == PayloadType.GET:
                packet = self._gen_packet_get(cmd["sequence"])

            if packet is not None:
                try:
                    self._sock.sendto(packet, (ipaddr, UDP_PORT))

                    now = time.time()

                    # set timeout
                    if "timeout" not in cmd:
                        cmd["timeout"] = now + ACK_TIMEOUT

                    # set earliest resend time
                    cmd["resend"] = now + ACK_RESEND

                    with self._packet_lock:
                        self._packets.append(cmd)

                # pylint: disable=broad-except
                except Exception:
                    pass