'Move the given database out of the way to make way for a new one.
"backup" (optional, default True) is a boolean indicating if
the original database should be backed up. If so, the backup
is $base_dir+".err".'

def reset(self, backup=True):

    self.acquire_lock()
    try:
        if exists(self.base_dir):
            if backup:
                err_base_dir = (self.base_dir + '.err')
                log.info("backing    up    db    to    '%s'", err_base_dir)
                if os.path.exists(err_base_dir):
                    rmdir(err_base_dir)
                    for i in range(10):
                        if (not os.path.exists(err_base_dir)):
                            break
                        time.sleep(1)
                if os.path.exists(err_base_dir):
                    log.warn("couldn't    remove    old    '%s'    (skipping    backup)", err_base_dir)
                    rmdir(self.base_dir)
                else:
                    os.rename(self.base_dir, err_base_dir)
            else:
                rmdir(self.base_dir)
        self._catalogs_zone = None
        self._stdlibs_zone = None
        self.create()
    finally:
        self.release_lock()
