def _range_func(self, withscores, score_cast_func):
        """
        Return a suitable function from (score, member)
        """
        if withscores:
            return lambda score_member: (score_member[1], score_cast_func(self._encode(score_member[0])))  # noqa
        else:
            return lambda score_member: score_member[1]
Return a suitable function from (score, member)