def METHOD_NAME(self, get_ipython, clear_output):
    """ Context manager that monkeypatches get_ipython and clear_output """
    original_clear_output = widget_output.clear_output
    original_get_ipython = widget_output.get_ipython
    widget_output.get_ipython = get_ipython
    widget_output.clear_output = clear_output
    try:
        yield
    finally:
        widget_output.clear_output = original_clear_output
        widget_output.get_ipython = original_get_ipython