def _rank_leaderboard(self, leaderboard, top_rank):
        length = len(leaderboard)
        if length == 0:
            return

        leaderboard.sort(key=lambda r: (-self.sort_by * r['score'], r['time']))

        num_top = top_rank[1]
        prev_rank = top_rank[0]
        # next rank = top rank + num equal top rank
        rank = prev_rank / num_top
        top_score = leaderboard[0]['score']
        prev_score = top_score
        for i in xrange(length):
            r = leaderboard[i]
            score = r['score']
            if score != prev_score:
                prev_score = score
                prev_rank = rank

            r['rank'] = prev_rank
            if score != top_score:
                rank += 1
dataset/ETHPy150Open turbulenz/turbulenz_local/turbulenz_local/models/apiv1/leaderboards.py/Leaderboard._rank_leaderboard/operator `+` -> `/`