Helper function from StreamHandler, consider removing if worried about clutter in TestRunnerAgent module. Largely useful so StreamHandler can replace most functionality from Pickle module relatively transparently.