<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def color_text_boxes(ax, labels, colors, color_arrow=True):
 """Color text boxes. Instead of this function, one can pass annotate_kwargs and plot_kwargs to plot_line_ids function. """

    assert len(labels) == len(colors), \
        "Equal no. of colors and lables must be given"
    boxes = ax.findobj(mpl.text.Annotation)
    box_labels = lineid_plot.unique_labels(labels)
    for box in boxes:
        l = box.get_label()
        try:
            loc = box_labels.index(l)
        except ValueError:
            continue  # No changes for this box
        box.set_color(colors[loc])
        if color_arrow:
            box.arrow_patch.set_color(colors[loc])

    ax.figure.canvas.draw()