add python3 compatibility, use separated _compat.py