def command_set_factory(bridge, group_number, led_type):
    """
    Create command set for controlling a specific led group.
    :param bridge: The bridge the leds are connected to.
    :param group_number: The group number.
    :param led_type: The type of the leds.
    :return: The created command set.
    """
    from limitlessled.group.commands.legacy import (
        CommandSetWhiteLegacy, CommandSetRgbwLegacy)
    from limitlessled.group.commands.v6 import (
        CommandSetBridgeLightV6, CommandSetWhiteV6,
        CommandSetDimmerV6, CommandSetRgbwV6,
        CommandSetRgbwwV6, CommandSetWrgbV6)

    command_sets = [CommandSetWhiteLegacy, CommandSetRgbwLegacy,
                    CommandSetBridgeLightV6, CommandSetWhiteV6,
                    CommandSetDimmerV6, CommandSetRgbwV6,
                    CommandSetRgbwwV6, CommandSetWrgbV6]
    try:
        cls = next(cs for cs in command_sets if
                   bridge.version in cs.SUPPORTED_VERSIONS and
                   led_type in cs.SUPPORTED_LED_TYPES)
        return cls(group_number)
    except StopIteration:
        raise ValueError('There is no command set for '
                         'specified bridge version and led type.')