def roller(timestamps, contract_dates, get_weights, **kwargs):
    timestamps = sorted(timestamps)
    contract_dates = contract_dates.sort_values()
    _check_contract_dates(contract_dates)
    weights = []
    validate_inputs = True
    ts = timestamps[0]
    weights.extend(get_weights(ts, contract_dates,
                               validate_inputs=validate_inputs, **kwargs))
    validate_inputs = False
    for ts in timestamps[1:]:
        weights.extend(get_weights(ts, contract_dates,
                                   validate_inputs=validate_inputs, **kwargs))
    weights = aggregate_weights(weights)
    return weights