Python 3 compatibility for Chapters 1-3

Mostly little print_function and unicode/bytes fixes