def _list_interface_private_addrs(eni_desc):
 primary = eni_desc.get('privateIpAddress')
 if (not primary):
  return None
 addresses = [primary]
 lst = eni_desc.get('privateIpAddressesSet', {}).get('item', [])
 if (not isinstance(lst, list)):
  return addresses
 for entry in lst:
  if (entry.get('primary') == 'true'):
   continue
  if entry.get('privateIpAddress'):
   addresses.append(entry.get('privateIpAddress'))
 return addresses

def _list_interface_private_addrs ( eni_desc ) : primary = eni_desc . get ( 'privateIpAddress' ) if ( not primary ) : return None addresses = [ primary ] lst = eni_desc . get ( 'privateIpAddressesSet' , { } ) . get ( 'item' , [ ] ) if ( not isinstance ( lst , list ) ) : return addresses for entry in lst : if ( entry . get ( 'primary' ) == 'true' ) : continue if entry . get ( 'privateIpAddress' ) : addresses . append ( entry . get ( 'privateIpAddress' ) ) return addresses
returns a list of all of the private ip addresses attached to a network interface .