Changes:

Converted print to sys.stdout.write,
Added UTF-8 encoding,
Un-dasiy-chained imports