Very clever!  This actually makes me think that we could use this approach to allow the JS side of things to be configured through Python side magics.  I love it!