'Builds a new mapping based on the new server range percentages.'

def _ComputeMappingFromPercentages(self, mapping, newperc):

    newstart = 0
    n_servers = self.mapping.num_servers
    servers = list(mapping.servers)
    new_mapping = rdf_data_server.DataServerMapping(version=(self.mapping.version + 1), num_servers=n_servers, pathing=self.mapping.pathing)
    for (i, perc) in enumerate(newperc):
        quant = int((perc * constants.MAX_RANGE))
        interval = rdf_data_server.DataServerInterval(start=newstart)
        end = (newstart + quant)
        if (i == (len(newperc) - 1)):
            end = constants.MAX_RANGE
        interval.end = end
        old_server = servers[i]
        newstart = end
        new_mapping.servers.Append(index=old_server.index, address=old_server.address, port=old_server.port, state=old_server.state, interval=interval)
    return new_mapping
