Code cleanup per review.

- Use util.format to format response string.
- Simplify ternary operator check for is_reply variable.