def prepare_data(*, data, x_name, y_name):
    """Change format from {"algo": ..., "algo_name": ..., "metrics": dict} to (algo, instance, x, y)."""
    res = []
    for met in data:
        res.append(
            (
                met["algo"],
                met["algo_name"],
                met["metrics"][x_name],
                met["metrics"][y_name],
            )
        )
    return res