If someone currently holds a partial lock (and consequently nobody can have a global lock) then maapi_is_lock_set() will return 0.
If you have the ietf-netconf-monitoring model enabled, you can see what partial locks are in place on e.g. the "running" datastore by traversing the operational data list /netconf-state/datastores/datastore{running}/locks.
The same information is also visible in the printouts done by "confd --state".
And, of course, if you attempt to do a partial lock on a path, and this succeeds, you know that it was not locked.