Python 3 compatibility for badge.py