def smart_fqdn_exists(fqdn, *args, **kwargs):
    # Try approach 1
    try:
        search_domain = mozdns.domain.models.Domain.objects.get(name=fqdn)
        label = ''
    except ObjectDoesNotExist:
        search_domain = None
    if search_domain:
        for type_, qset in _build_label_domain_queries(label, search_domain,
                                                       **kwargs):
            if qset.exists():
                return qset

    # Try approach 2
    search_domain = None
    if len(fqdn.split('.')) == 1:
        return None
    try:
        label = fqdn.split('.')[0]
        domain_name = '.'.join(fqdn.split('.')[1:])
        search_domain = mozdns.domain.models.Domain.objects.get(
            name=domain_name)
    except ObjectDoesNotExist:
        search_domain = None
    if search_domain:
        for type_, qset in _build_label_domain_queries(label, search_domain,
                                                       **kwargs):
            if qset.exists():
                return qset
Send a message method from one pid to another with an optional body.
dataset/ETHPy150Open mozilla/inventory/mozdns/search_utils.py/smart_fqdn_exists--crossover with--dataset/ETHPy150Open wickman/compactor/compactor/context.py/Context.send