use print-function for python3 compatibility
use raise ... form syntax for py3 compatibility