Use str.format instead of %

Switched from % to `str.format` since that is the recommended approach since Python 2.6. We need to confirm that all the use cases in this change are still working.