use print-function for python3 compatibility
use raise ... form syntax for py3 compatibility
Merge pull request #374 from ljos/master

Make some code py3 compatible