def _get_dvs(service_instance, dvs_name):
 switches = list_dvs(service_instance)
 if (dvs_name in switches):
  inventory = get_inventory(service_instance)
  container = inventory.viewManager.CreateContainerView(inventory.rootFolder, [vim.DistributedVirtualSwitch], True)
  for item in container.view:
   if (item.name == dvs_name):
    return item
 return None

def _get_dvs ( service_instance , dvs_name ) : switches = list_dvs ( service_instance ) if ( dvs_name in switches ) : inventory = get_inventory ( service_instance ) container = inventory . viewManager . CreateContainerView ( inventory . rootFolder , [ vim . DistributedVirtualSwitch ] , True ) for item in container . view : if ( item . name == dvs_name ) : return item return None
return a reference to a distributed virtual switch object .