code: def _get_weighted_random_name(name_list):
          
          total_weight = name_list[-1]['weight_high']
          random_weight = random.randrange(total_weight + 1)
  
          left = 0
          right = len(name_list) - 1
  
          while left <= right:
              index = (left + right) // 2
              entry = name_list[index]
  
              if random_weight > entry['weight_high']:
                  left = index + 1
              elif random_weight < entry['weight_low']:
                  right = index - 1
              else:
                  return entry['name']
docs: Get a random name from a given list, according to its frequency.
  
          The choice of the name is random, but weighted in proportion
          to the relative frequency or popularity of each name in the
          list. If one name is twice as popular as another one, then it
          is twice as likely to get chosen.
  
          :param name_list: The list of names from which to pick.
          :return str: A randomly chosen name.