Looks like you're using a mixture of indents and spacing which can upset python. If you're using vim, you can paste the following lines into your ~/.vimrc and tabs will always be converted into 4 spaces for you when editing files in vim:

""""""""""""""""""""""""""""""""""""""""""""""""
"Set tab to be '    ' (4 spaces):
""""""""""""""""""""""""""""""""""""""""""""""""
set tabstop=4
set softtabstop=4
set shiftwidth=4
set smarttab
set expandtab