Converts trial results from multiple sweeps to v2 protobuf message.

trial_sweeps Iterable over sweeps and then over trial results within each sweep.
measurements List of info about measurements in the program.
out Optional message to populate. If not given, create a new message.

ValueError If the number of repetitions in trial results were not all the same.