def worst_asns(address): if not address: return None _ = addr_to_int(address) for prefix, mask, name in WORST_ASNS.get(address.split('.')[0], {}): if _ & mask == prefix: return name return None
def worst_asns(address): if not address: return None try: _ = addr_to_int(address) for prefix, mask, name in WORST_ASNS.get(address.split('.')[0], {}): if _ & mask == prefix: return name except (IndexError, ValueError): pass return None