How can I get the library section id for a given show or season?



I'm trying to figure out how to get this librarySectionKey="/library/sections/11" type of data which is in the XML that the web UI uses.
I have a media object and metadata for show / season / episode in my plugin's update method but I can't seem to figure out how to find out the show's parent section id.