Python exception and message tracker