Git blame says you added your above mine 7 days after me - maybe we were on different branches?  I also feel like I've seen this before then, maybe it got moved?

Anyway, I feel like using %r instead of %s probably handles any encoding issues and anyway it's code that shouldn't be called outside of debugging.

https://github.com/dimagi/casexml/blame/e472ef852ccec924ccfaaf3f3a032380bd5fa24a/casexml/apps/case/models.py#L302