Leave off the "if __name__" stuff
I'd suggest leaving off the
if __name__ == '__main__':
line. That's useful when you have a python file that might be used as either a script or imported into another module. It's pretty clear from the way the rest of the code is structured that this code could only be used as a script.