If this code is from 2007 it's possible that Pygame was refactored into different submodules and pygame.joystick went away. Maybe you can try installing a version of Pygame from 2007, though there's no guarantee that will work.
Either that or start digging into the documentation, see what happened to pygame.joystick (maybe it got buried into something like pygame.devices.joystick) and make the necessary modifications.
Just a thought...2007 is eons ago in the world of software libraries.
--
Check out our new shield:
http://www.ruggedcircuits.com/html/gadget_shield.html