def build_vlan_qsets(vlan_name):
    try:
        if vlan_name.isdigit():
            vlan = Vlan.objects.get(number=vlan_name)
        else:
            vlan = Vlan.objects.get(name=vlan_name)
    except __HOLE__:
        raise BadDirective("{0} isn't a valid "
                           "vlan identifier.".format(vlan_name))
    except MultipleObjectsReturned:
        raise BadDirective("{0} doesn't uniquely identify"
                           "a vlan.".format(vlan_name))
    return build_ipf_qsets(vlan.compile_Q())
dataset/ETHPy150Open rtucker-mozilla/mozilla_inventory/core/search/compiler/invfilter.py/build_vlan_qsets