def order_methods(runs, baselines, args):
    methods = []
    for pattern in args.methods:
        for method in sorted(set((r.method for r in runs))):
            if pattern.search(method):
                if (method not in methods):
                    methods.append(method)
                if (method not in args.colors):
                    index = (len(args.colors) % len(args.palette))
                    args.colors[method] = args.palette[index]
    non_baseline_colors = len(args.colors)
    for pattern in args.baselines:
        for method in sorted(set((r.method for r in baselines))):
            if pattern.search(method):
                if (method not in methods):
                    methods.append(method)
                if (method not in args.colors):
                    index = (len(args.colors) - non_baseline_colors)
                    index = (index % len(PALETTES['baselines']))
                    args.colors[method] = PALETTES['baselines'][index]
    return methods
def order_methods(runs, baselines, args):
    methods = []
    for pattern in args.methods:
        for method in sorted(set((r.method for r in runs))):
            if pattern.search(method):
                if (method not in methods):
                    methods.append(method)
                if (method not in args.colors):
                    index = (len(args.colors) % len(args.palette))
                    args.colors[method] = args.palette[index]
    non_baseline_colors = len(args.colors)
    for pattern in args.baselines:
        for method in sorted(set((r.method for r in baselines))):
            if pattern.search(method):
                if (method not in methods):
                    methods.append(method)
                if (method not in args.colors):
                    index = (len(args.colors) - non_baseline_colors)
                    index = (index % len(PALETTES['baselines']))
                    args.colors[method] = PALETTES['baselines'][index]
    return methods