i use this function to print objects in a nice way.
1. output is formatted like python code over multiple lines
2. dictionaries are output in key sorted order
3. dictionary keys are padded to make the same length for the same dictionary
4. strings are appended with slice code to show the length
5. types are appended in comments
6. "empty" follows the type for empty subobjects
7. the name passed in the call is shown like a key unless ...
8. if '=' is appended to the name then it is formatted like a variable being assigned.
9. indent= indents the output by that many spaces
10. file= is supported for output redirection
11. it is intended to work in both python2 and python3
12. run it as a command to run the test
since the code is large (245 lines, 9924 chars) i am making a link:
if that works better in your browser