Encode unicode as utf-8 in domain lookup

`_domain_cache_key` now encodes strings as utf-8 to prevent hashlib.md5() from raising an `UnicodeDecodeError`. This change was discussed here: https://github.com/dimagi/commcare-hq/pull/372