Looking back at Jerry's old post I see that
apm_package_id_from_key
was created.
As you said, you could have a package key, but couldn't precisely determine the url (or the proper instance) of the package without diving into the SQL.
If the package you're interested in is not a singleton or service, or cannot be found with
site_node_closest_ancestor_package*
then the
proper instance of a package is a tricky thing to define, or at least package specific, I think...