def sort_df_by(df, by):
    """
    Returns the order of items in column `by` in long-form DF that would sort
    the DF by mean accuracy across folds. Useful for seaborn's x_order, hue_order, etc
    :param df:
    :param by:
    :return:
    """
    mean_scores = df.groupby(by).Accuracy.mean()
    return list(mean_scores.index[mean_scores.argsort()])