def get_best_model(comparison_result, metric="fmeasure", reverse=False):
    """
    Returns the model row in dataframe which has the best performance on a given metric

    :param comparison_result: a dataframe containing  evaluation info about various models
    :param metric: metric on which a comparison is be made, defaults to "fmeasure"
    :return: a dataframe row corresponding to the model which has the best score on the given metric
    """
    if reverse:
        model_row = comparison_result[
            comparison_result[metric] == comparison_result[metric].min()
        ]
    else:
        model_row = comparison_result[
            comparison_result[metric] == comparison_result[metric].max()
        ]
    return model_row.iloc[0]