@vm_ref_cache_from_instance
def get_vm_ref(session, instance):
 uuid = instance.uuid
 vm_ref = (search_vm_ref_by_identifier(session, uuid) or _get_vm_ref_from_name(session, instance.name))
 if (vm_ref is None):
  raise exception.InstanceNotFound(instance_id=uuid)
 return vm_ref

@ vm_ref_cache_from_instance def get_vm_ref ( session , instance ) : uuid = instance . uuid vm_ref = ( search_vm_ref_by_identifier ( session , uuid ) or _get_vm_ref_from_name ( session , instance . name ) ) if ( vm_ref is None ) : raise exception . InstanceNotFound ( instance_id = uuid ) return vm_ref
get reference to the vm through uuid or vm name .