iPython Notebook support

Any recommendations for how to make this DRYer?