Implement python3 compatibility