update util/tobinary.py syntax to support old version python