Added change to support Python 3

From here: http://stackoverflow.com/a/22297179/61938