pull some methods out of main.py and move into utils.py

I'm planning on adding a GUI at some point and realized some of the
methods in main.py could be utilized by the GUI. So it made sense to pull
those methods out into a utils file.
add unit tests for utils.py

A couple of small unit tests for utils.py. This was primarily an
exercise in mocking.