Support Python 2 and 3 input

https://gist.github.com/le717/6189349