This is the code behind the Switching Eds blog post: http://matthewearl.github.io/2015/07/28/switching-eds-with-python/ See the above for an explanation of the code.