Implement the debugstatus package.

Abstract out some helper functions to be used in the charm store and similar services.

(Review request: http://reviews.vapour.ws/r/628/)
I'm swithering about making this into a json object. We're already using it for structured data. I could be persuaded either way.