Update utils.py

str / bytes coexistence support