def shutdown_notebook(request, username):
    """Stop any running notebook for a user."""

    manager = get_notebook_manager(request)
    if manager.is_running(username):
        manager.stop_notebook(username)
Stop any running notebook for a user.