small refactor

https://github.com/dimagi/dimagi-utils/pull/75/