This could be a simple / cheap way to get a time-travelling debugger. Run your code through vardbg generating a video. If that run results in unexpected behaviour then you can step back and forward through the video and see where things went wrong.
However, you could use RevPDB: https://morepypy.blogspot.com/2016/07/reverse-debugging-for-...