Python formatting pprint output – specially hex

I'm pretty new to Python. Using python3.6.6. I work with many large, nested data structures and it is very convenient to output them in text files with pprint.pprint. However, I want all the integers in the structure to be printed as hex constants, but I do not see any way to do that. I could write custom print routines and use the hex () function, but that would be a lot of work and I would have to write separate routines for each data structure. Any suggestions?

Many thanks,

David