Improving coding style of utils.py