use dict comprehension

https://github.com/dimagi/commcare-hq/pull/4331/files#r18253579

@emord