code: def _get_device_by_label(devices, label):
      '''
      Returns the device with the given label, raises error if the device is
      not found.
  
      devices
          list of vim.vm.device.VirtualDevice objects
  
      key
          Unique key of device
      '''
      device_labels = [d for d in devices if d.deviceInfo.label == label]
      if device_labels:
          return device_labels[0]
      else:
          raise salt.exceptions.VMwareObjectNotFoundError(
              'Virtual machine device with '
              'label {0} does not exist'.format(label)f _get_device_by_label(devices, label):
      '''
      Returns the device with the given label, raises error if the device is
      not found.
  
      devices
          list of vim.vm.device.VirtualDevice objects
  
      key
          Unique key of device
      '''
      device_labels = [d for d in devices if d.deviceInfo.label == label]
      if device_labels:
          return device_labels[0]
      else:
          raise salt.exceptions.VMwareObjectNotFoundError(
              'Virtual machine device with '
              'label {0} does not exist'.format(label))
docs: Returns the device with the given label, raises error if the device is
      not found.
  
      devices
          list of vim.vm.device.VirtualDevice objects
  
      key
          Unique key of device