@classmethod
    def get_domain_default_backend(cls, backend_type, domain, id_only=False):
        result = SQLMobileBackendMapping.objects.filter(
            is_global=False,
            domain=domain,
            backend_type=backend_type,
            prefix='*'
        ).values_list('backend_id', flat=True)

        if len(result) > 1:
            raise cls.MultipleObjectsReturned(
                "More than one default backend found for backend_type %s, "
                "domain %s" % (backend_type, domain)
            )
        elif len(result) == 1:
            if id_only:
                return result[0]
            else:
                return cls.load(result[0])
        else:
            return None
dataset/ETHPy150Open dimagi/commcare-hq/corehq/apps/sms/models.py/SQLMobileBackend.get_domain_default_backend/original