This function assumes (and asserts on) the existence of the required captured attribute within the spec. It is the responsibility of the caller to verify that the spec is properly setup before calling this function.