DOC: fix problem with part of code example cut off

Probably a bug in the ipython directive, but for now just fixing by putting it in seperate code blocks (only the first def() rendered)