def get_public_ip_block(module, driver, network_domain, block_id=False, base_ip=False):
 if (block_id is not False):
  try:
   block = driver.ex_get_public_ip_block(block_id)
  except DimensionDataAPIException:
   e = get_exception()
   if ((e.code == 'RESOURCE_NOT_FOUND') or (e.code == 'UNEXPECTED_ERROR')):
    module.exit_json(changed=False, msg='Public IP Block does not exist')
   else:
    module.fail_json(msg=('Unexpected error while retrieving block: %s' % e.code))
   module.fail_json(msg=('Error retreving Public IP Block ' + ("'%s': %s" % (block.id, e.message))))
 else:
  blocks = list_public_ip_blocks(module, driver, network_domain)
  if (blocks is not False):
   block = next((block for block in blocks if (block.base_ip == base_ip)))
  else:
   module.exit_json(changed=False, msg=("IP block starting with '%s' does not exist." % base_ip))
 return block

def get_public_ip_block ( module , driver , network_domain , block_id = False , base_ip = False ) : if ( block_id is not False ) : try : block = driver . ex_get_public_ip_block ( block_id ) except DimensionDataAPIException : e = get_exception ( ) if ( ( e . code == 'RESOURCE_NOT_FOUND' ) or ( e . code == 'UNEXPECTED_ERROR' ) ) : module . exit_json ( changed = False , msg = 'Public IP Block does not exist' ) else : module . fail_json ( msg = ( 'Unexpected error while retrieving block: %s' % e . code ) ) module . fail_json ( msg = ( 'Error retreving Public IP Block ' + ( "'%s': %s" % ( block . id , e . message ) ) ) ) else : blocks = list_public_ip_blocks ( module , driver , network_domain ) if ( blocks is not False ) : block = next ( ( block for block in blocks if ( block . base_ip == base_ip ) ) ) else : module . exit_json ( changed = False , msg = ( "IP block starting with '%s' does not exist." % base_ip ) ) return block
get public ip block details .