def _get_free_devices_for_request(self, pci_request, pci_devs): count = pci_request.get('count', 1) spec = pci_request.get('spec', []) devs = self._filter_devices_for_spec(spec, pci_devs) if len(devs) < count: return None else: return devs[:count]