def get_all_commcare_users_by_domain(domain):
    from corehq.apps.users.models import CommCareUser

    def get_ids():
        for flag in ['active', 'inactive']:
            key = [flag, domain, CommCareUser.__name__]
            for user in CommCareUser.get_db().view(
                'users/by_domain',
                startkey=key,
                endkey=key + [{}],
                reduce=False,
                include_docs=False
            ):
                yield user['id']

    return imap(CommCareUser.wrap, iter_docs(CommCareUser.get_db(), get_ids()))
Imports all from all modules
dataset/ETHPy150Open dimagi/commcare-hq/corehq/apps/users/dbaccessors/all_commcare_users.py/get_all_commcare_users_by_domain--crossover with--dataset/ETHPy150Open sobolevn/django-split-settings/example/tests/test_import.py/TestModuleImport.test_wildcard_import