def _get_presser(fig):
    'Get our press callback.'
    import matplotlib
    callbacks = fig.canvas.callbacks.callbacks['button_press_event']
    func = None
    for (key, val) in callbacks.items():
        if (LooseVersion(matplotlib.__version__) >= '3'):
            func = val()
        else:
            func = val.func
        if (func.__class__.__name__ == 'partial'):
            break
        else:
            func = None
    assert (func is not None)
    return func
Get our press callback.
def _get_presser(fig):
    
    import matplotlib
    callbacks = fig.canvas.callbacks.callbacks['button_press_event']
    func = None
    for (key, val) in callbacks.items():
        if (LooseVersion(matplotlib.__version__) >= '3'):
            func = val()
        else:
            func = val.func
        if (func.__class__.__name__ == 'partial'):
            break
        else:
            func = None
    assert (func is not None)
    return func