def get_free_range(parent_range, excluded_ranges, size=PRIMARY_VIP_RANGE_SIZE):
 free_cidrs = (netaddr.IPSet([parent_range]) - netaddr.IPSet(excluded_ranges))
 for cidr in free_cidrs.iter_cidrs():
  if (cidr.prefixlen <= size):
   return ('%s/%s' % (cidr.network, size))
 raise ValueError((_('Network of size %(size)s, from IP range %(parent_range)s excluding IP ranges %(excluded_ranges)s was not found.') % {'size': size, 'parent_range': parent_range, 'excluded_ranges': excluded_ranges}))

def get_free_range ( parent_range , excluded_ranges , size = PRIMARY_VIP_RANGE_SIZE ) : free_cidrs = ( netaddr . IPSet ( [ parent_range ] ) - netaddr . IPSet ( excluded_ranges ) ) for cidr in free_cidrs . iter_cidrs ( ) : if ( cidr . prefixlen <= size ) : return ( '%s/%s' % ( cidr . network , size ) ) raise ValueError ( ( _ ( 'Network of size %(size)s, from IP range %(parent_range)s excluding IP ranges %(excluded_ranges)s was not found.' ) % { 'size' : size , 'parent_range' : parent_range , 'excluded_ranges' : excluded_ranges } ) )
get a free ip range .