def list2str(cfg):
    for (key, value) in cfg.items():
        if isinstance(value, dict):
            cfg[key] = list2str(value)
        elif isinstance(value, list):
            if ((len(value) == 0) or isinstance(value[0], (int, float))):
                cfg[key] = str(value)
            else:
                for (i, item) in enumerate(value):
                    if isinstance(item, dict):
                        value[i] = list2str(item)
                cfg[key] = value
    return cfg
def list2str(cfg):
    for (key, value) in cfg.items():
        if isinstance(value, dict):
            cfg[key] = list2str(value)
        elif isinstance(value, list):
            if ((len(value) == 0) or isinstance(value[0], (int, float))):
                cfg[key] = str(value)
            else:
                for (i, item) in enumerate(value):
                    if isinstance(item, dict):
                        value[i] = list2str(item)
                cfg[key] = value
    return cfg