Few changes to support running on python3
Encode to utf-8 at the FileWriter level so that we catch all undecodable strings
Switch from functions to variables to encapsulate python2/3 differences
Merge pull request #9 from abadger/feature/python3

Few changes to support running on python3