def get_network_detach_config_spec(client_factory, device, port_index):
 config_spec = client_factory.create('ns0:VirtualMachineConfigSpec')
 virtual_device_config = client_factory.create('ns0:VirtualDeviceConfigSpec')
 virtual_device_config.operation = 'remove'
 virtual_device_config.device = device
 config_spec.deviceChange = [virtual_device_config]
 config_spec.extraConfig = [_iface_id_option_value(client_factory, 'free', port_index)]
 return config_spec

def get_network_detach_config_spec ( client_factory , device , port_index ) : config_spec = client_factory . create ( 'ns0:VirtualMachineConfigSpec' ) virtual_device_config = client_factory . create ( 'ns0:VirtualDeviceConfigSpec' ) virtual_device_config . operation = 'remove' virtual_device_config . device = device config_spec . deviceChange = [ virtual_device_config ] config_spec . extraConfig = [ _iface_id_option_value ( client_factory , 'free' , port_index ) ] return config_spec
builds the vif detach config spec .