human
Here's a good function header given the following:
I wrote the below code

    list_of_vertex_lists = []
    polygons_drawn = []
    temp_list = []
    preview_polygon_drawn = []
    if (image.ndim not in (2, 3)):
        raise ValueError('Only    2D    grayscale    or    RGB    images    are    supported.')
    (fig, ax) = plt.subplots()
    fig.subplots_adjust(bottom=0.2)
    ax.imshow(image, cmap='gray')
    ax.set_axis_off()
    def _undo(*args, **kwargs):
        if list_of_vertex_lists:
            list_of_vertex_lists.pop()
            last_poly = polygons_drawn.pop()
            last_poly.remove()
            fig.canvas.draw_idle()
    undo_pos = fig.add_axes([0.85, 0.05, 0.075, 0.075])
    undo_button = matplotlib.widgets.Button(undo_pos, u'\u27f2')
    undo_button.on_clicked(_undo)
    def _extend_polygon(event):
        if ((event.inaxes is None) or (event.inaxes is undo_pos)):
            return
        if (fig.canvas.manager.toolbar._active is not None):
            return
        if (event.button == LEFT_CLICK):
            temp_list.append([event.xdata, event.ydata])
            if preview_polygon_drawn:
                poly = preview_polygon_drawn.pop()
                poly.remove()
            polygon = _draw_polygon(ax, temp_list, alpha=(alpha / 1.4))
            preview_polygon_drawn.append(polygon)
        elif (event.button == RIGHT_CLICK):
            if (not temp_list):
                return
            list_of_vertex_lists.append(temp_list[:])
            polygon_object = _draw_polygon(ax, temp_list, alpha=alpha)
            polygons_drawn.append(polygon_object)
            preview_poly = preview_polygon_drawn.pop()
            preview_poly.remove()
            del temp_list[:]
            plt.draw()
    fig.canvas.mpl_connect('button_press_event', _extend_polygon)
    plt.show(block=True)
    labels = (_mask_from_vertices(vertices, image.shape[:2], i) for (i, vertices) in enumerate(list_of_vertex_lists, start=1))
    if return_all:
        return np.stack(labels)
    else:
        return reduce(np.maximum, labels, np.broadcast_to(0, image.shape[:2]))

What's a good function header?
assistant
#Here's a good function header.

def manual_polygon_segmentation(image, alpha=0.4, return_all=False):