-1 for adding this function to psd-tools. Why is IPython.lib.pretty not enough? 

I kind of dislike the implementation: globals are bad, and the code is complex enough to deserve tests which are not present. If you find this function useful you can put it in a module external to psd-tools and use it; it doesn't have to live in psd-tools source code.