python3 compatibility: fix gen_commands, print -> print()