def AddSegment(self, size, label=None, color=None, pie_index=0):
    """Add a pie segment to this chart, and return the segment.

    size: The size of the segment.
    label: The label for the segment.
    color: The color of the segment, or None to automatically choose the color.
    pie_index: The index of the pie that will receive the new segment.
      By default, the chart has one pie (pie #0); use the AddPie method to
      add more pies.
    """
    if isinstance(size, Segment):
      warnings.warn("AddSegment(segment) is deprecated.  Use AddSegment(size, "
                    "label, color) instead",  DeprecationWarning, stacklevel=2)
      segment = size
    else:
      segment = Segment(size, label=label, color=color)
    assert segment.size >= 0
    if pie_index == 0 and not self.data:
      # Create the default pie
      self.data.append([])
    assert (pie_index >= 0 and pie_index < len(self.data))
    self.data[pie_index].append(segment)
    return segment
Add a pie segment to this chart, and return the segment.

    size: The size of the segment.
    label: The label for the segment.
    color: The color of the segment, or None to automatically choose the color.
    pie_index: The index of the pie that will receive the new segment.
      By default, the chart has one pie (pie #0); use the AddPie method to
      add more pies.
    
mapreduce/lib/graphy/pie_chart.py