making example and code compatible with python 2.7