def round_list(data, n_digits):
    """
    Recursively round all floats in a list to n digits.

    :param data: the list to round
    :type data: list
    :param n_digits: amount of digits to round to
    :type n_digits: int
    :return: the list with values rounded
    :rtype: list
    """

    result = data.copy()

    for i, value in enumerate(data):
        if isinstance(value, float):
            result[i] = round(value, n_digits)
        elif isinstance(value, list):
            result[i] = round_list(value, n_digits)

    return result