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/)
Not sure that all possible callers would end up serializing these results: I'd be inclined to keep it as is for now.