'Converts Interface to ExportedNetworkInterfaces.'

def Convert(self, metadata, interface, token=None):

    ip4_addresses = []
    ip6_addresses = []
    for addr in interface.addresses:
        if (addr.address_type == addr.Family.INET):
            ip4_addresses.append(addr.human_readable_address)
        elif (addr.address_type == addr.Family.INET6):
            ip6_addresses.append(addr.human_readable_address)
        else:
            raise ValueError('Invalid    address    type:    %s', addr.address_type)
    result = ExportedNetworkInterface(metadata=metadata, ifname=interface.ifname, ip4_addresses='    '.join(ip4_addresses), ip6_addresses='    '.join(ip6_addresses))
    if interface.mac_address:
        result.mac_address = interface.mac_address.human_readable_address
    (yield result)
