https://blog.devgenius.io/unraveling-i-o-mysteries-a-python-programmers-guide-to-debugging-input-output-issues-f811944a4b6d