r"""
    Args:
        cfg_list (list):
        default_cfg (None): (default = None)
        checkname (bool): if True removes names if they are all the same.

    Returns:
        list: cfglbl_list

    CommandLine:
        python -m utool.util_gridsearch --exec-get_varied_cfg_lbls

    Example:
        >>> # ENABLE_DOCTEST
        >>> from utool.util_gridsearch import *  # NOQA
        >>> import utool as ut
        >>> cfg_list = [{'_cfgname': 'test', 'f': 1, 'b': 1},
        >>>             {'_cfgname': 'test', 'f': 2, 'b': 1},
        >>>             {'_cfgname': 'test', 'f': 3, 'b': 1, 'z': 4}]
        >>> default_cfg = None
        >>> cfglbl_list = get_varied_cfg_lbls(cfg_list, default_cfg)
        >>> result = ('cfglbl_list = %s' % (ut.repr2(cfglbl_list),))
        >>> print(result)
        cfglbl_list = ['test:f=1', 'test:f=2', 'test:f=3,z=4']

def get_varied_cfg_lbls(cfg_list, default_cfg=None, mainkey='_cfgname',
                        checkname=False):
    r"""
    Args:
        cfg_list (list):
        default_cfg (None): (default = None)
        checkname (bool): if True removes names if they are all the same.

    Returns:
        list: cfglbl_list

    CommandLine:
        python -m utool.util_gridsearch --exec-get_varied_cfg_lbls

    Example:
        >>> # ENABLE_DOCTEST
        >>> from utool.util_gridsearch import *  # NOQA
        >>> import utool as ut
        >>> cfg_list = [{'_cfgname': 'test', 'f': 1, 'b': 1},
        >>>             {'_cfgname': 'test', 'f': 2, 'b': 1},
        >>>             {'_cfgname': 'test', 'f': 3, 'b': 1, 'z': 4}]
        >>> default_cfg = None
        >>> cfglbl_list = get_varied_cfg_lbls(cfg_list, default_cfg)
        >>> result = ('cfglbl_list = %s' % (ut.repr2(cfglbl_list),))
        >>> print(result)
        cfglbl_list = ['test:f=1', 'test:f=2', 'test:f=3,z=4']
    """
    import utool as ut
    try:
        cfgname_list = [cfg[mainkey] for cfg in cfg_list]
    except KeyError:
        cfgname_list = [''] * len(cfg_list)
    varied_cfg_list = partition_varied_cfg_list(cfg_list, default_cfg)[1]
    if checkname and ut.allsame(cfgname_list):
        cfgname_list = [None] * len(cfgname_list)
    cfglbl_list = [get_cfg_lbl(cfg, name)
                   for cfg, name in zip(varied_cfg_list, cfgname_list)]
    if checkname:
        cfglbl_list = [x.lstrip(':') for x in cfglbl_list]
    return cfglbl_list