re-implement python3 support