Is this code in Python 2 or Python 3? What would be the Python 2 implementation of this code? What is the reason they changed the syntax?