def _write_leaderboard(self):
        self._sort_scores()
        try:
            self._set_path()
            with self.lock:
                try:
                    f = open(unicode(self.path), 'w')
                    yaml.dump([s.to_dict() for s in self.scores], f, default_flow_style=False)
                finally:
                    f.close()
        except IOError as e:
            LOG.error('Failed writing leaderboard file "%s": %s', self.path, str(e))
            raise LeaderboardError('Failed writing leaderboard file %s' % self.path)
dataset/ETHPy150Open turbulenz/turbulenz_local/turbulenz_local/models/apiv1/leaderboards.py/Leaderboard._write_leaderboard/original