used alternate syntax for catching exceptions, using six for compatibility between python versions and converted print statements to calls
fixed the tokenizer difference
cleaned utils.safestr method, does not break db tests
db module and its test now compatible to both python 2 and python 3 using six