def find_rescue_device(hardware_devices, instance):
 for device in hardware_devices.VirtualDevice:
  if ((device.__class__.__name__ == 'VirtualDisk') and (device.backing.__class__.__name__ == 'VirtualDiskFlatVer2BackingInfo') and device.backing.fileName.endswith('-rescue.vmdk')):
   return device
 msg = (_('Rescue device does not exist for instance %s') % instance.uuid)
 raise exception.NotFound(msg)

def find_rescue_device ( hardware_devices , instance ) : for device in hardware_devices . VirtualDevice : if ( ( device . __class__ . __name__ == 'VirtualDisk' ) and ( device . backing . __class__ . __name__ == 'VirtualDiskFlatVer2BackingInfo' ) and device . backing . fileName . endswith ( '-rescue.vmdk' ) ) : return device msg = ( _ ( 'Rescue device does not exist for instance %s' ) % instance . uuid ) raise exception . NotFound ( msg )
returns the rescue device .