code: def get_datacenter(service_instance, datacenter_name):
      '''
      Returns a vim.Datacenter managed object.
  
      service_instance
          The Service Instance Object from which to obtain datacenter.
  
      datacenter_name
          The datacenter name
      '''
      items = get_datacenters(service_instance,
                              datacenter_names=[datacenter_name])
      if not items:
          raise salt.exceptions.VMwareObjectRetrievalError(
              'Datacenter \'{0}\' was not found'.format(datacenter_name))
      return items[0f get_datacenter(service_instance, datacenter_name):
      '''
      Returns a vim.Datacenter managed object.
  
      service_instance
          The Service Instance Object from which to obtain datacenter.
  
      datacenter_name
          The datacenter name
      '''
      items = get_datacenters(service_instance,
                              datacenter_names=[datacenter_name])
      if not items:
          raise salt.exceptions.VMwareObjectRetrievalError(
              'Datacenter \'{0}\' was not found'.format(datacenter_name))
      return items[0]
docs: Returns a vim.Datacenter managed object.
  
      service_instance
          The Service Instance Object from which to obtain datacenter.
  
      datacenter_name
          The datacenter name