Implement Python 2 compatibility