def format_metrics(d: dict) -> dict:
    """
    Format the floats in a dict with nested dicts, for display.

    :param d: dict containing floats to format
    :return: new dict matching the original, except with formatted floats
    """
    new = {}

    for key in d:
        if isinstance(d[key], dict):
            new[key] = format_metrics(d[key])
        elif isinstance(d[key], float):
            new[key] = float("{:.8f}".format(d[key]))
        else:
            new[key] = d[key]

    return new