This and related methods could potentially be collapsed now that we have the metadata a dict already. I'll make an issue.
 
Originally posted by @garrettwrong in #902 (comment)
Since our metadata is now backed by a dict, we should review this method to see if it can be futher simplified.