def cast_python_object_to_aggregate(obj, aggregate):
    """ This function casts a python object to an aggregate type. For instance:
    [1.,2.,3.]-> ARRAY(1,3,REAL)"""
    aggregate_lower_bound = aggregate.bound_1()
    aggregate_upper_bound = aggregate.bound_2()
    if type(obj)==list:
        for idx in range(aggregate_lower_bound,aggregate_upper_bound+1):
            aggregate[idx] = obj[idx-aggregate_lower_bound]
    return aggregate