'Parse the XML element and return an EC2NetworkInterface object.
:param      name: An optional name for the interface. If not provided
then either tag with a key "Name" or the interface ID
will be used (whichever is available first in that
order).
:type       name: ``str``
:rtype:     :class: `EC2NetworkInterface`'

def _to_interface(self, element, name=None):

    interface_id = findtext(element=element, xpath='networkInterfaceId', namespace=NAMESPACE)
    state = findtext(element=element, xpath='status', namespace=NAMESPACE)
    tags = self._get_resource_tags(element)
    name = (name if name else tags.get('Name', interface_id))
    groups = self._get_security_groups(element)
    priv_ips = []
    for item in findall(element=element, xpath='privateIpAddressesSet/item', namespace=NAMESPACE):
        priv_ips.append({'private_ip': findtext(element=item, xpath='privateIpAddress', namespace=NAMESPACE), 'private_dns': findtext(element=item, xpath='privateDnsName', namespace=NAMESPACE), 'primary': findtext(element=item, xpath='primary', namespace=NAMESPACE)})
    attributes_map = RESOURCE_EXTRA_ATTRIBUTES_MAP['network_interface_attachment']
    attachment = self._get_extra_dict(element, attributes_map)
    attributes_map = RESOURCE_EXTRA_ATTRIBUTES_MAP['network_interface']
    extra = self._get_extra_dict(element, attributes_map)
    extra['tags'] = tags
    extra['attachment'] = attachment
    extra['private_ips'] = priv_ips
    extra['groups'] = groups
    return EC2NetworkInterface(interface_id, name, state, extra=extra)
