def calc_sums(variable):
    """
    Aggregates the instance dimension of the variable tensor object (see documentation in ../process_raw_data.py)
    by summing up the values of the instances.
    note: this function is called after the database check -> all values are available and valid.

    :param variable: data structure as defined (int or float as value type)
    :return: sums_list (one sum for each iteration; float), n (int)
    """
    any_instance = next(iter(variable))
    iterations = len(variable[any_instance]['values'])
    n = len(variable)
    sums = [0.0] * iterations
    for instance_name, instance in variable.items():
        for i, value in enumerate(instance['values']):
            sums[i] += float(value)
    return sums, n