def get_ips(server, access_ip=True):
 private = []
 public = []
 address_list = []
 addresses = getattr(server, 'addresses', {})
 if (len(addresses) > 0):
  for network in itervalues(addresses):
   for address in network:
    if (address.get('OS-EXT-IPS:type', False) == 'fixed'):
     private.append(address['addr'])
    elif (address.get('OS-EXT-IPS:type', False) == 'floating'):
     public.append(address['addr'])
 if (not access_ip):
  address_list.append(server.accessIPv4)
  address_list.extend(private)
  address_list.extend(public)
  return address_list
 access_ip = None
 if server.accessIPv4:
  access_ip = server.accessIPv4
 if ((not access_ip) and public and (not (private and prefer_private))):
  access_ip = public[0]
 if (private and (not access_ip)):
  access_ip = private[0]
 return access_ip

def get_ips ( server , access_ip = True ) : private = [ ] public = [ ] address_list = [ ] addresses = getattr ( server , 'addresses' , { } ) if ( len ( addresses ) > 0 ) : for network in itervalues ( addresses ) : for address in network : if ( address . get ( 'OS-EXT-IPS:type' , False ) == 'fixed' ) : private . append ( address [ 'addr' ] ) elif ( address . get ( 'OS-EXT-IPS:type' , False ) == 'floating' ) : public . append ( address [ 'addr' ] ) if ( not access_ip ) : address_list . append ( server . accessIPv4 ) address_list . extend ( private ) address_list . extend ( public ) return address_list access_ip = None if server . accessIPv4 : access_ip = server . accessIPv4 if ( ( not access_ip ) and public and ( not ( private and prefer_private ) ) ) : access_ip = public [ 0 ] if ( private and ( not access_ip ) ) : access_ip = private [ 0 ] return access_ip
returns public and private ip addresses .