returns a label for each variation in a varydict.

    It tries to not be oververbose and returns only what parameters are varied
    in each label.

    CommandLine:
        python -m utool.util_dict --test-all_dict_combinations_lbls
        python -m utool.util_dict --exec-all_dict_combinations_lbls:1

    Example:
        >>> # ENABLE_DOCTEST
        >>> import utool
        >>> from utool.util_dict import *  # NOQA
        >>> varied_dict = {'logdist_weight': [0.0, 1.0], 'pipeline_root': ['vsmany'], 'sv_on': [True, False, None]}
        >>> comb_lbls = utool.all_dict_combinations_lbls(varied_dict)
        >>> result = (utool.repr4(comb_lbls))
        >>> print(result)
        [
            'logdist_weight=0.0,sv_on=True',
            'logdist_weight=0.0,sv_on=False',
            'logdist_weight=0.0,sv_on=None',
            'logdist_weight=1.0,sv_on=True',
            'logdist_weight=1.0,sv_on=False',
            'logdist_weight=1.0,sv_on=None',
        ]

    Example:
        >>> # ENABLE_DOCTEST
        >>> import utool as ut
        >>> from utool.util_dict import *  # NOQA
        >>> varied_dict = {'logdist_weight': [0.0], 'pipeline_root': ['vsmany'], 'sv_on': [True]}
        >>> allow_lone_singles = True
        >>> comb_lbls = ut.all_dict_combinations_lbls(varied_dict, allow_lone_singles=allow_lone_singles)
        >>> result = (ut.repr4(comb_lbls))
        >>> print(result)
        [
            'logdist_weight=0.0,pipeline_root=vsmany,sv_on=True',
        ]

def all_dict_combinations_lbls(varied_dict, remove_singles=True, allow_lone_singles=False):
    """
    returns a label for each variation in a varydict.

    It tries to not be oververbose and returns only what parameters are varied
    in each label.

    CommandLine:
        python -m utool.util_dict --test-all_dict_combinations_lbls
        python -m utool.util_dict --exec-all_dict_combinations_lbls:1

    Example:
        >>> # ENABLE_DOCTEST
        >>> import utool
        >>> from utool.util_dict import *  # NOQA
        >>> varied_dict = {'logdist_weight': [0.0, 1.0], 'pipeline_root': ['vsmany'], 'sv_on': [True, False, None]}
        >>> comb_lbls = utool.all_dict_combinations_lbls(varied_dict)
        >>> result = (utool.repr4(comb_lbls))
        >>> print(result)
        [
            'logdist_weight=0.0,sv_on=True',
            'logdist_weight=0.0,sv_on=False',
            'logdist_weight=0.0,sv_on=None',
            'logdist_weight=1.0,sv_on=True',
            'logdist_weight=1.0,sv_on=False',
            'logdist_weight=1.0,sv_on=None',
        ]

    Example:
        >>> # ENABLE_DOCTEST
        >>> import utool as ut
        >>> from utool.util_dict import *  # NOQA
        >>> varied_dict = {'logdist_weight': [0.0], 'pipeline_root': ['vsmany'], 'sv_on': [True]}
        >>> allow_lone_singles = True
        >>> comb_lbls = ut.all_dict_combinations_lbls(varied_dict, allow_lone_singles=allow_lone_singles)
        >>> result = (ut.repr4(comb_lbls))
        >>> print(result)
        [
            'logdist_weight=0.0,pipeline_root=vsmany,sv_on=True',
        ]
    """
    is_lone_single = all([
        isinstance(val_list, (list, tuple)) and len(val_list) == 1
        for key, val_list in iteritems_sorted(varied_dict)
    ])
    if not remove_singles or (allow_lone_singles and is_lone_single):
        # all entries have one length
        multitups_list = [
            [(key, val) for val in val_list]
            for key, val_list in iteritems_sorted(varied_dict)
        ]
    else:
        multitups_list = [
            [(key, val) for val in val_list]
            for key, val_list in iteritems_sorted(varied_dict)
            if isinstance(val_list, (list, tuple)) and len(val_list) > 1]
    combtup_list = list(it.product(*multitups_list))
    combtup_list2 = [
        [(key, val) if isinstance(val, six.string_types) else (key, repr(val))
         for (key, val) in combtup]
        for combtup in combtup_list]
    comb_lbls = [','.join(['%s=%s' % (key, val) for (key, val) in combtup])
                 for combtup in combtup_list2]
    #comb_lbls = list(map(str, comb_pairs))
    return comb_lbls