code: def _diff_interface_lists(old, new):
      '''
      Compare network interface definitions to extract the changes
  
      :param old: list of ElementTree nodes representing the old interfaces
      :param new: list of ElementTree nodes representing the new interfaces
      '''
      diff = _diff_lists(old, new, _nics_equal)
  
      # Remove duplicated addresses mac addresses and let libvirt generate them for us
      macs = [nic.find('mac').get('address') for nic in diff['unchanged']]
      for nic in diff['new']:
          mac = nic.find('mac')
          if mac.get('address') in macs:
              nic.remove(mac)
  
      return diff _diff_interface_lists(old, new):
      '''
      Compare network interface definitions to extract the changes
  
      :param old: list of ElementTree nodes representing the old interfaces
      :param new: list of ElementTree nodes representing the new interfaces
      '''
      diff = _diff_lists(old, new, _nics_equal)
  
      # Remove duplicated addresses mac addresses and let libvirt generate them for us
      macs = [nic.find('mac').get('address') for nic in diff['unchanged']]
      for nic in diff['new']:
          mac = nic.find('mac')
          if mac.get('address') in macs:
              nic.remove(mac)
  
      return diff
docs: Compare network interface definitions to extract the changes
  
      :param old: list of ElementTree nodes representing the old interfaces
      :param new: list of ElementTree nodes representing the new interfaces