def _get_ipython_scope():
    """
    Tries to extract the dictionary of variables if the program is running
    in an IPython notebook environment.
    """
    try:
        from IPython import get_ipython
        shell = get_ipython()
        return shell.user_ns
    except Exception as e:
        return None
