Using Python to trace threads through history