def _get_applicable_vm_recs(xenapi):
 for vm_ref in call_xenapi(xenapi, 'VM.get_all'):
  try:
   vm_rec = call_xenapi(xenapi, 'VM.get_record', vm_ref)
  except XenAPI.Failure as e:
   if (e.details[0] != 'HANDLE_INVALID'):
    raise
   continue
  if (vm_rec['is_a_template'] or vm_rec['is_control_domain']):
   continue
  (yield (vm_ref, vm_rec))

def _get_applicable_vm_recs ( xenapi ) : for vm_ref in call_xenapi ( xenapi , 'VM.get_all' ) : try : vm_rec = call_xenapi ( xenapi , 'VM.get_record' , vm_ref ) except XenAPI . Failure as e : if ( e . details [ 0 ] != 'HANDLE_INVALID' ) : raise continue if ( vm_rec [ 'is_a_template' ] or vm_rec [ 'is_control_domain' ] ) : continue ( yield ( vm_ref , vm_rec ) )
an applicable vm is one that is not a template and not the control domain .