Your code contains lots of needless blank lines. More generally, your code should stick to the PEP8 coding style guidelines. You can use the "pep8" command line tool for helping you find style mistakes.