def createdb(self, template=None):
        assert template is None or template.startswith('test_db'), template
        assert template is None or int(template[7:]) <= self._db_counter, (template, self._db_counter)
        dbs = self._db_preload.get(template, [])
        try:
            dbname = dbs.pop()
        except __HOLE__:
            dbname = None
        if dbname is None:
            dbname = self._next_dbname()
            self._createdb(dbname, template)
        if len(dbs) <= self._max_prepared and template is not None and \
                (self._is_bg_thread is None or not self._is_bg_thread.isAlive()):
            # NOTE: we only prepare templated databases if we can
            if self._is_bg_thread is not None:
                self._is_bg_thread.join() # make very sure the current bg thread is finished
            preload_dbname = self._next_dbname()
            if template not in self._db_preload:
                self._db_preload[template] = []
            self._is_bg_thread = threading.Thread(target=self._preload, args=(preload_dbname, template, ))
            self._is_bg_thread.start()
        return dbname
dataset/ETHPy150Open jinty/van.pg/van/pg/_cluster.py/RunningCluster.createdb