def results_from_proto(
    msg: result_pb2.Result, measurements: list[MeasureInfo] | None = None
) -> Sequence[Sequence[cirq.Result]]:
    """Converts a v2 result proto into List of list of trial results.

    Args:
        msg: v2 Result message to convert.
        measurements: List of info about expected measurements in the program.
            This may be used for custom ordering of the result. If no
            measurement config is provided, then all results will be returned
            in the order specified within the result.

    Returns:
        A list containing a list of trial results for each sweep.
    """

    measure_map = {m.key: m for m in measurements} if measurements else None
    return [
        _trial_sweep_from_proto(sweep_result, measure_map) for sweep_result in msg.sweep_results
    ]
Converts a v2 result proto into List of list of trial results.

    Args:
        msg: v2 Result message to convert.
        measurements: List of info about expected measurements in the program.
            This may be used for custom ordering of the result. If no
            measurement config is provided, then all results will be returned
            in the order specified within the result.

    Returns:
        A list containing a list of trial results for each sweep.
    
cirq-google/cirq_google/api/v2/results.py