'Remove a PCI device from allocations or claims.
If there are no more PCI devices, pop the uuid.'

def _remove_device_from_pci_mapping(self, instance_uuid, pci_device, pci_mapping):

    pci_devices = pci_mapping.get(instance_uuid, [])
    if (pci_device in pci_devices):
        pci_devices.remove(pci_device)
        if (len(pci_devices) == 0):
            pci_mapping.pop(instance_uuid, None)
