def _get_datastore(self, datastore_name=None):
        """
        Returns the couch datastore instance and datastore name.
        This caches the datastore instance to avoid an explicit lookup to save on http request.
        The consequence is that if another process deletes the datastore in the meantime, we will fail later.
        """
        datastore_name = self._get_datastore_name(datastore_name)

        if datastore_name in self._datastore_cache:
            return self._datastore_cache[datastore_name], datastore_name

        try:
            ds = self.server[datastore_name]   # Note: causes http lookup
            self._datastore_cache[datastore_name] = ds
            return ds, datastore_name
        except ResourceNotFound:
            raise NotFound("Datastore '%s' does not exist" % datastore_name)
        except __HOLE__:
            raise BadRequest("Datastore name '%s' invalid" % datastore_name)
        except ServerError as se:
            raise BadRequest("Data store name %s invalid" % datastore_name)
dataset/ETHPy150Open ooici/pyon/pyon/datastore/couchdb/base_store.py/CouchDataStore._get_datastore