def _recover_sweep_const(const_pb: run_context_pb2.ConstValue) -> Any:
    """Recover a const value from the sweep const message."""
    if const_pb.WhichOneof('value') == 'is_none':
        return None
    if const_pb.WhichOneof('value') == 'float_value':
        return const_pb.float_value
    if const_pb.WhichOneof('value') == 'int_value':
        return const_pb.int_value
    if const_pb.WhichOneof('value') == 'string_value':
        return const_pb.string_value
    if const_pb.WhichOneof('value') == 'with_unit_value':
        return tunits.Value.from_proto(const_pb.with_unit_value)
Recover a const value from the sweep const message.
cirq-google/cirq_google/api/v2/sweeps.py