def device_exists_with_ips_and_mac(device_name, ip_cidrs, mac, namespace=None):
 try:
  device = IPDevice(device_name, namespace=namespace)
  if (mac != device.link.address):
   return False
  device_ip_cidrs = [ip['cidr'] for ip in device.addr.list()]
  for ip_cidr in ip_cidrs:
   if (ip_cidr not in device_ip_cidrs):
    return False
 except RuntimeError:
  return False
 else:
  return True

def device_exists_with_ips_and_mac ( device_name , ip_cidrs , mac , namespace = None ) : try : device = IPDevice ( device_name , namespace = namespace ) if ( mac != device . link . address ) : return False device_ip_cidrs = [ ip [ 'cidr' ] for ip in device . addr . list ( ) ] for ip_cidr in ip_cidrs : if ( ip_cidr not in device_ip_cidrs ) : return False except RuntimeError : return False else : return True
return true if the device with the given ip addresses and mac address exists in the namespace .