Pick a version from a routing group using a random or provided value
            A routing group looks like (weight, version):
            {"APP": [[29431330, 'A'], [82426238, 'B'], [101760716, 'C'], [118725487, 'D'], [122951927, 'E']]}

def resolve_group_to_version(self, name, value=None):
        """ Pick a version from a routing group using a random or provided value
            A routing group looks like (weight, version):
            {"APP": [[29431330, 'A'], [82426238, 'B'], [101760716, 'C'], [118725487, 'D'], [122951927, 'E']]}
        """
        if name not in self.current_rg:
            return name

        routing_group = self.current_rg[name]
        if len(routing_group) == 0:
            self.logger.warning("empty rounting group %s", name)
            return name

        value = value or random.randint(0, 1 << 32)
        index = upper_bound(routing_group, value)
        return routing_group[index if index < len(routing_group) else 0][1]