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/)