Run batch of commands in sequence.

            Input is positional arguments with (function pointer, *args) tuples.

            This method is useful for executing commands to multiple groups with retries,
            without having too long delays. For example,

            - Set group 1 to red and brightness to 10%
            - Set group 2 to red and brightness to 10%
            - Set group 3 to white and brightness to 100%
            - Turn off group 4

            With three repeats, running these consecutively takes approximately 100ms * 13 commands * 3 times = 3.9 seconds.

            With batch_run, execution takes same time, but first loop - each command is sent once to every group -
            is finished within 1.3 seconds. After that, each command is repeated two times. Most of the time, this ensures
            slightly faster changes for each group.

            Usage:

            led.batch_run((led.set_color, "red", 1), (led.set_brightness, 10, 1), (led.set_color, "white", 3), ...)

def batch_run(self, *commands):
        """ Run batch of commands in sequence.

            Input is positional arguments with (function pointer, *args) tuples.

            This method is useful for executing commands to multiple groups with retries,
            without having too long delays. For example,

            - Set group 1 to red and brightness to 10%
            - Set group 2 to red and brightness to 10%
            - Set group 3 to white and brightness to 100%
            - Turn off group 4

            With three repeats, running these consecutively takes approximately 100ms * 13 commands * 3 times = 3.9 seconds.

            With batch_run, execution takes same time, but first loop - each command is sent once to every group -
            is finished within 1.3 seconds. After that, each command is repeated two times. Most of the time, this ensures
            slightly faster changes for each group.

            Usage:

            led.batch_run((led.set_color, "red", 1), (led.set_brightness, 10, 1), (led.set_color, "white", 3), ...)
        """
        original_retries = self.repeat_commands
        self.repeat_commands = 1
        for _ in range(original_retries):
            for command in commands:
                cmd = command[0]
                args = command[1:]
                cmd(*args)
        self.repeat_commands = original_retries