<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_boxes_and_lines(ax, labels):
 """Get boxes and lines using labels as id."""

    labels_u, labels_u_line = get_labels(labels)
    boxes = ax.findobj(mpl.text.Annotation)
    lines = ax.findobj(mpl.lines.Line2D)
    lineid_boxes = []
    lineid_lines = []

    for box in boxes:
        l = box.get_label()
        try:
            loc = labels_u.index(l)
        except ValueError:
            # this box is either one not added by lineidplot or has no label.
            continue
        lineid_boxes.append(box)

    for line in lines:
        l = line.get_label()
        try:
            loc = labels_u_line.index(l)
        except ValueError:
            # this line is either one not added by lineidplot or has no label.
            continue
        lineid_lines.append(line)

    return lineid_boxes, lineid_lines