Python 3 refactor

Refactored code to run in Python 3.4+
Switched to python inbuilt logging

Added python logging library and command line parsing for log level.
Changed DEBUG print statements to logging.debug() statements.
Added debug command line flag

And tweaked logging message formats.
Code cleanup
Code Cleanup