make all examples compatible with python3

all changes in only one commit.