def get_blocks_with_unallocated(module, cp_driver, lb_driver, network_domain):
 total_unallocated_ips = 0
 all_blocks = list_public_ip_blocks(module, cp_driver, network_domain)
 unalloc_blocks = []
 unalloc_addresses = []
 for block in all_blocks:
  d_blocks = get_block_allocation(module, cp_driver, lb_driver, network_domain, block)
  i = 0
  for addr in d_blocks['addresses']:
   if (addr['allocated'] is False):
    if (i == 0):
     unalloc_blocks.append(d_blocks)
    unalloc_addresses.append(addr['address'])
    total_unallocated_ips += 1
   i += 1
 return {'unallocated_count': total_unallocated_ips, 'ip_blocks': unalloc_blocks, 'unallocated_addresses': unalloc_addresses}

def get_blocks_with_unallocated ( module , cp_driver , lb_driver , network_domain ) : total_unallocated_ips = 0 all_blocks = list_public_ip_blocks ( module , cp_driver , network_domain ) unalloc_blocks = [ ] unalloc_addresses = [ ] for block in all_blocks : d_blocks = get_block_allocation ( module , cp_driver , lb_driver , network_domain , block ) i = 0 for addr in d_blocks [ 'addresses' ] : if ( addr [ 'allocated' ] is False ) : if ( i == 0 ) : unalloc_blocks . append ( d_blocks ) unalloc_addresses . append ( addr [ 'address' ] ) total_unallocated_ips += 1 i += 1 return { 'unallocated_count' : total_unallocated_ips , 'ip_blocks' : unalloc_blocks , 'unallocated_addresses' : unalloc_addresses }
gets ip blocks with one or more unallocated ips .