https://jamesls.com/posts/troubleshooting-python-code/