def _handle_device_dependents(self, pci_dev):
        """Remove device dependents or a parent from pools.

        In case the device is a PF, all of it's dependent VFs should
        be removed from pools count, if these are present.
        When the device is a VF, it's parent PF pool count should be
        decreased, unless it is no longer in a pool.
        """
        if pci_dev.dev_type == fields.PciDeviceType.SRIOV_PF:
            vfs_list = objects.PciDeviceList.get_by_parent_address(
                                       pci_dev._context,
                                       pci_dev.compute_node_id,
                                       pci_dev.address)
            if vfs_list:
                for vf in vfs_list:
                    self.remove_device(vf)
        elif pci_dev.dev_type == fields.PciDeviceType.SRIOV_VF:
            try:
                parent = pci_dev.get_by_dev_addr(pci_dev._context,
                                                 pci_dev.compute_node_id,
                                                 pci_dev.parent_addr)
                # Make sure not to decrease PF pool count if this parent has
                # been already removed from pools
                if self.get_free_devs() in parent:
                    self.remove_device(parent)
            except exception.PciDeviceNotFound:
                return
dataset/ETHPy150Open BU-NU-CLOUD-SP16/Trusted-Platform-Module-nova/nova/pci/stats.py/PciDeviceStats._handle_device_dependents/swapped operands of `in`