def get_vm_ref_from_name(session, vm_name):
 vms = session._call_method(vim_util, 'get_objects', 'VirtualMachine', ['name'])
 for vm in vms:
  if (vm.propSet[0].val == vm_name):
   return vm.obj
 return None

def get_vm_ref_from_name ( session , vm_name ) : vms = session . _call_method ( vim_util , 'get_objects' , 'VirtualMachine' , [ 'name' ] ) for vm in vms : if ( vm . propSet [ 0 ] . val == vm_name ) : return vm . obj return None
get reference to the vm with the name specified .