Scripting: How to find attribute when Note and NoteGroupReference are default?

The API states that Note:getAttributes() returns NaN (or null for Lua) when the attribute is set to the default value:

For numeric properties, the value is NaN if the note uses the default value based on the NoteGroupReference it is in.

NoteGroupReference:getVoice() is similar:

Get an object holding the default voice properties for this group, similar to Note#getAttributes .

Like getAttributes(), it returns NaNl (or null for Lua) if the NoteGroupReference is using the default value.

How can the default value for an attribute be determined programatically if both Note and NoteGroupReference are default values?