def predict_param(language_models,
                  comp_metric,
                  x_distribution,
                  best_only=True):
    """
    Predict the language of x.

    Parameters
    ----------
    language_models : dict
        language => model
    comp_metric : function with two parameters (model_dist, x_dist)
    x_distribution : numpy array of dtype float
    best_only : bool, optional (default: True)
        If this is True, then only the most likely language code is be returned
        Otherwise, the list of tuples is returned.

    Returns
    -------
    distances : list of tuples or str
        If best_only, then [(distance, 'language'), ...]
        Otherwise, 'language'
    """
    distances = []  # tuples (distance, language)
    for lang, model_distribution in language_models.items():
        distance = comp_metric(model_distribution, x_distribution)
        distances.append((distance, lang))
    if best_only:
        return min(distances)[1]
    else:
        return distances