def stop_watching_memory():
    """Unregister memory profiling tools from IPython instance."""
    global watching_memory
    watching_memory = False
    ip = get_ipython()
    try:
        ip.events.unregister("post_run_cell", watch_memory)
    except ValueError:
        pass
    try:
        ip.events.unregister("pre_run_cell", pre_run_cell)
    except __HOLE__:
        pass
dataset/ETHPy150Open ianozsvald/ipython_memory_usage/src/ipython_memory_usage/ipython_memory_usage_perf.py/stop_watching_memory