def METHOD_NAME(stats, output):
    for experiment_name in stats:
        experiment_stats = stats[experiment_name]
        header = get_table_header(experiment_stats)
        median_table = []
        total_table = []
        for algorithm_name in experiment_stats:
            algorithm_stats = experiment_stats[algorithm_name]
            median_row = []
            total_row = []
            for parameter in header:
                cur_stat = algorithm_stats[parameter]
                total = np.round(cur_stat["TotalTime"], 3)
                median_row.append(get_median_str(cur_stat))
                total_row.append(total)
            median_table.append(median_row)
            total_table.append(total_row)
        index = experiment_stats.keys()
        median_table = pd.DataFrame(median_table, index=index, columns=header)
        total_table = pd.DataFrame(total_table, index=index, columns=header)
        with open(experiment_name + output, 'w') as f:
            f.write('Median time per iter, sec')
            f.write('\n')
            f.write(median_table.to_string())
            f.write('\n')
            f.write('Total time, sec')
            f.write('\n')
            f.write(total_table.to_string())
            f.write('\n')