Emacs/Python - function expected an indented block

I made the switch to Emacs. I am using Elpy within Emacs as an IDE. My setup is side-by-side windows, on the left is a buffer(script) where I write/edit the code which then gets sent to the IPython shell on the right with

To send the whole buffer you can press C-c C-c . You can send the whole region with C-c C-r and you can send the current line that you are by binding the following function. The following function is essentially a copy of python-shell-send-buffer