It would be helpful to have a way to check if a value is a keyvaluepair
Does this block do it ?
See the is_a_pair value procedure in this sample.