Make module compatible with Python 2