def measurement_key_objs(val: Any) -> frozenset[cirq.MeasurementKey]:
    """Gets the measurement key objects of measurements within the given value.

    Args:
        val: The value which has the measurement key.

    Returns:
        The measurement key objects of the value. If the value has no measurement,
        the result is the empty set.
    """
    result = _measurement_key_objs_from_magic_methods(val)
    if result is not NotImplemented and result is not None:
        return result
    key_strings = _measurement_key_names_from_magic_methods(val)
    if key_strings is not NotImplemented and key_strings is not None:
        return frozenset(value.MeasurementKey.parse_serialized(key_str) for key_str in key_strings)
    return frozenset()
Gets the measurement key objects of measurements within the given value.

    Args:
        val: The value which has the measurement key.

    Returns:
        The measurement key objects of the value. If the value has no measurement,
        the result is the empty set.
    
cirq-core/cirq/protocols/measurement_key_protocol.py