Move formatting utilities to utils.py