'Create a tuntap with the specified attributes.
The device is cleaned up at the end of the test.
:param attr: A Device namedtuple
:return: A tuntap ip_lib.IPDevice'

def manage_device(self, attr):

    ip = ip_lib.IPWrapper(namespace=attr.namespace)
    if attr.namespace:
        ip.netns.add(attr.namespace)
        self.addCleanup(ip.netns.delete, attr.namespace)
    tap_device = ip.add_tuntap(attr.name)
    self.addCleanup(self._safe_delete_device, tap_device)
    tap_device.link.set_address(attr.mac_address)
    self.driver.init_l3(attr.name, attr.ip_cidrs, namespace=attr.namespace)
    tap_device.link.set_up()
    return tap_device
