Implement the debugstatus package.

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