def rax_find_loadbalancer(module, rax_module, loadbalancer):
 clb = rax_module.cloud_loadbalancers
 try:
  found = clb.get(loadbalancer)
 except:
  found = []
  for lb in clb.list():
   if (loadbalancer == lb.name):
    found.append(lb)
  if (not found):
   module.fail_json(msg='No loadbalancer was matched')
  if (len(found) > 1):
   module.fail_json(msg='Multiple loadbalancers matched')
  found = found[0]
 return found

def rax_find_loadbalancer ( module , rax_module , loadbalancer ) : clb = rax_module . cloud_loadbalancers try : found = clb . get ( loadbalancer ) except : found = [ ] for lb in clb . list ( ) : if ( loadbalancer == lb . name ) : found . append ( lb ) if ( not found ) : module . fail_json ( msg = 'No loadbalancer was matched' ) if ( len ( found ) > 1 ) : module . fail_json ( msg = 'Multiple loadbalancers matched' ) found = found [ 0 ] return found
find a cloud load balancer by id or name .