def _get_host_ref(service_instance, host, host_name=None):
 search_index = salt.utils.vmware.get_inventory(service_instance).searchIndex
 if host_name:
  host_ref = search_index.FindByDnsName(dnsName=host_name, vmSearch=False)
 else:
  host_ref = search_index.FindByDnsName(dnsName=host, vmSearch=False)
 if (host_ref is None):
  host_ref = search_index.FindByIp(ip=host, vmSearch=False)
 return host_ref

def _get_host_ref ( service_instance , host , host_name = None ) : search_index = salt . utils . vmware . get_inventory ( service_instance ) . searchIndex if host_name : host_ref = search_index . FindByDnsName ( dnsName = host_name , vmSearch = False ) else : host_ref = search_index . FindByDnsName ( dnsName = host , vmSearch = False ) if ( host_ref is None ) : host_ref = search_index . FindByIp ( ip = host , vmSearch = False ) return host_ref
helper function that returns a host object either from the host location or the host_name .