ugh, will refactor in a PR for dimagi_utils