Update examples

Update example scripts to run under both Python 2 and Python 3.