def get_datacenters(service_instance, datacenter_names=None, get_all_datacenters=False):
 items = [i['object'] for i in get_mors_with_properties(service_instance, vim.Datacenter, property_list=['name']) if (get_all_datacenters or (datacenter_names and (i['name'] in datacenter_names)))]
 return items

def get_datacenters ( service_instance , datacenter_names = None , get_all_datacenters = False ) : items = [ i [ 'object' ] for i in get_mors_with_properties ( service_instance , vim . Datacenter , property_list = [ 'name' ] ) if ( get_all_datacenters or ( datacenter_names and ( i [ 'name' ] in datacenter_names ) ) ) ] return items
returns all datacenters in a vcenter .