dude, this is so non-pythonic (try making it more readable if you've time, else it's fine)