human
Complete the below
def key_press_handler(event, canvas, toolbar=None):

    ''''Implement the default mpl key bindings for the canvas and toolbar
    described at :ref:`key-event-handling`
    Parameters
    event : :class:`KeyEvent`
    a key press/release event
    canvas : :class:`FigureCanvasBase`
    the backend-specific canvas instance
    toolbar : :class:`NavigationToolbar2`
    the navigation cursor toolbar'
    '''
 ... Give me a the Python program you requested?
assistant
#Here is the Python program you requested.
    if (event.key is None):
        return
    fullscreen_keys = rcParams[u'keymap.fullscreen']
    home_keys = rcParams[u'keymap.home']
    back_keys = rcParams[u'keymap.back']
    forward_keys = rcParams[u'keymap.forward']
    pan_keys = rcParams[u'keymap.pan']
    zoom_keys = rcParams[u'keymap.zoom']
    save_keys = rcParams[u'keymap.save']
    quit_keys = rcParams[u'keymap.quit']
    grid_keys = rcParams[u'keymap.grid']
    grid_minor_keys = rcParams[u'keymap.grid_minor']
    toggle_yscale_keys = rcParams[u'keymap.yscale']
    toggle_xscale_keys = rcParams[u'keymap.xscale']
    all_keys = rcParams[u'keymap.all_axes']
    if (event.key in fullscreen_keys):
        try:
            canvas.manager.full_screen_toggle()
        except AttributeError:
            pass
    if (event.key in quit_keys):
        Gcf.destroy_fig(canvas.figure)
    if (toolbar is not None):
        if (event.key in home_keys):
            toolbar.home()
        elif (event.key in back_keys):
            toolbar.back()
        elif (event.key in forward_keys):
            toolbar.forward()
        elif (event.key in pan_keys):
            toolbar.pan()
            toolbar._set_cursor(event)
        elif (event.key in zoom_keys):
            toolbar.zoom()
            toolbar._set_cursor(event)
        elif (event.key in save_keys):
            toolbar.save_figure()
    if (event.inaxes is None):
        return
    def _get_uniform_gridstate(ticks):
        if all((tick.gridOn for tick in ticks)):
            return True
        elif (not any((tick.gridOn for tick in ticks))):
            return False
        else:
            return None
    ax = event.inaxes
    if ((event.key in grid_keys) and (None not in [_get_uniform_gridstate(ax.xaxis.minorTicks), _get_uniform_gridstate(ax.yaxis.minorTicks)])):
        x_state = _get_uniform_gridstate(ax.xaxis.majorTicks)
        y_state = _get_uniform_gridstate(ax.yaxis.majorTicks)
        cycle = [(False, False), (True, False), (True, True), (False, True)]
        try:
            (x_state,...