def round_elements_keeping_sum(float_list, benchmark_list):
    """Helper function for chi2test

    Round a list of float numbers maintaining the sum. Adjustment of the
    difference will be made on the biggest element in the list.

    Parameters
    ----------
    float_list : list (float)
        List containing decimal numbers to round off.

    benchmark_list: list
        Sum of all its elements will be a benchmark for the other.

    Returns
    -------
    round_list : list (int)
        Rounded list
    """
    round_list = [round(x) for x in float_list]
    # difference between sums of lists
    diff = sum(benchmark_list)-sum(round_list)
    # difference adjustment
    if diff != 0:
        # on the biggest element
        round_list[round_list.index(max(round_list))] += diff
    return round_list