Creating a custom magic command in an IPython extension