Python version of the "semaphores" example code, using the sysv_ipc package