code: def AddIndex(self, path_segment_index):
      
      if path_segment_index in self._weight_per_index:
        raise ValueError('Path segment index already set.')
  
      self._weight_per_index[path_segment_index] = 0
docs: Adds a path segment index and sets its weight to 0.
  
      Args:
        path_segment_index: an integer containing the path segment index.
  
      Raises:
        ValueError: if the path segment weights already contains
                    the path segment index.