<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def add_zoom_buttons(viewer, canvas=None, color='black'):
 """Add zoom buttons to a canvas. Parameters viewer : an ImageView subclass instance If True, show the color bar; else remove it if present. canvas : a DrawingCanvas instance The canvas to which the buttons should be added. If not supplied defaults to the private canvas of the viewer. color : str A color name, hex triplet. The default is 'black'. """

    def zoom(box, canvas, event, pt, viewer, n):
        zl = viewer.get_zoom()
        zl += n
        if zl == 0.0:
            zl += n
        viewer.zoom_to(zl + n)

    def add_buttons(viewer, canvas, tag):
        objs = []
        wd, ht = viewer.get_window_size()
        SquareBox = canvas.get_draw_class('squarebox')
        Text = canvas.get_draw_class('text')
        Compound = canvas.get_draw_class('compoundobject')
        x1, y1 = wd - 20, ht // 2 + 20
        zoomin = SquareBox(x1, y1, 15, color='yellow', fill=True,
                           fillcolor='gray', fillalpha=0.5, coord='window')
        zoomin.editable = False
        zoomin.pickable = True
        zoomin.add_callback('pick-down', zoom, viewer, 1)
        objs.append(zoomin)
        x2, y2 = wd - 20, ht // 2 - 20
        zoomout = SquareBox(x2, y2, 15, color='yellow', fill=True,
                            fillcolor='gray', fillalpha=0.5, coord='window')
        zoomout.editable = False
        zoomout.pickable = True
        zoomout.add_callback('pick-down', zoom, viewer, -1)
        objs.append(zoomout)
        objs.append(Text(x1 - 4, y1 + 6, text='+', fontsize=18, color=color,
                         coord='window'))
        objs.append(Text(x2 - 4, y2 + 6, text='--', fontsize=18, color=color,
                         coord='window'))
        obj = Compound(*objs)
        obj.opaque = False
        canvas.add(obj, tag=tag)

    def zoom_resize(viewer, width, height, canvas, tag):
        try:
            canvas.get_object_by_tag(tag)
        except KeyError:
            return False

        canvas.delete_object_by_tag(tag)
        add_buttons(viewer, canvas, tag)

    tag = '_$zoom_buttons'
    if canvas is None:
        canvas = viewer.get_private_canvas()
    canvas.ui_set_active(True)
    canvas.register_for_cursor_drawing(viewer)
    canvas.set_draw_mode('pick')
    viewer.add_callback('configure', zoom_resize, canvas, tag)

    add_buttons(viewer, canvas, tag)