Initial Py3k support and other tune-ups

*   Make `print` and `urllib2`/`urllib` usage compatible between Python 2 and 3
*   Factor out some globals in anticipation of unit testing
*   Perform trivial clean-ups