def _find_contiguous_colors(colors):
    """
    Helper function that finds the continuous segments of colors
    and returns those segments
    Code adapted from:
    http://abhay.harpale.net/blog/python/how-to-plot-multicolored-lines-in-matplotlib/
    """
    segs = []
    curr_seg = []
    prev_color = ''
    for c in colors:
        if c == prev_color or prev_color == '':
            curr_seg.append(c)
        else:
            segs.append(curr_seg)
            curr_seg = []
            curr_seg.append(c)
        prev_color = c
    segs.append(curr_seg) # the final one
    return segs