def getModelFNameFromHyperPars(pref, *hyperParsList, suff=None) :
    """
    Generate a model filename from a list [hyperpar_entry ... ]
    where each hyperpar_entry is either a dict of hyperparameter values
    or a tuple (hyperpars_dict, default_hyperpars_dict).
    In the second case, only the values different from the default
    are used to generate the filename.

    The filename is in the format pref_key1_val1_key2_val2...
    """
    res = pref
    for hyperPars in hyperParsList :
        if isinstance(hyperPars,tuple) or isinstance(hyperPars,list) :
            hyperPars, defHyperPars = hyperPars
        else :
            defHyperPars = {}
        for k in sorted(hyperPars.keys()) :
            if hyperPars[k] != defHyperPars.get(k) :
                res += '_{}_{}'.format(k,hyperPars[k]).replace('.','_')
    return res+(('_'+suff) if suff else '')