voting model python implementation