SPOILER ALERT: Do not read if you have not yet watched “Patty,” the penultimate episode of “The Good Place.”

The titular good place on Mike Schur’s philosophical comedy “The Good Place” isn’t a literal place at all but instead a state of mind.

Sure, after four seasons (50 episodes) the characters on the show did take a hot balloon ride to heaven — although the show doesn’t call it that — but when they got there, they quickly realized it was not all it had been cracked up to be. Instead, what would make the time there worth spending was that the souls there believed they could choose when that time came to an end.

Did “The Good Place” just promote death with dignity?

“When you come up with an idea that is based purely in philosophy, you can help but think about death with dignity, you can’t help but think about the way that people exist on Earth and the choices they sometimes need to make when their lives are in decline or in crisis. It certainly does touch on that; there’s no question that we talked about that a lot — we looked at all of the different political and philosophical ramifications of that idea,” Schur tells Variety.

In the penultimate episode of “The Good Place,” entitled “Patty,” Michael (Ted Danson), the humans he was once in charge of torturing, and the afterlife’s assistant, Janet (D’Arcy Carden) found the inhabitants of the good place in such dire straits that the committee in charge of it defected their posts, tricking Michael into signing a document to becoming the new leader. Meanwhile, the rest of the souls had been there for thousands of years and “when perfection goes on forever, you become this glass-eyed mush person,” said ancient philosopher and mathematician Hypatia of Alexandria (played by guest star Lisa Kudrow).

As Eleanor (Kristen Bell) put it: “You’ve basically been on a never-ending vacation, and vacations are only special because they end.” So Michael, remembering something Eleanor had previously told him about humans are always a little sad because of their awareness of death looming, instituted a solution: They would set up a new kind of door that, once walked through, would end a person’s time in the universe. The idea was modeled on the green doors the good place had that allowed people to walk through into any time and place.

“You led great lives. You earned your place here. So stay as long as you like, use the green doors to see and do every single thing you want to see and do, and when you’re ready, walk through one last door and be at peace,” Michael said.

Says Schur: “It starts, as all things on this show do, with philosophy. A lot of the reading that we did and a lot of the discussions we had over four years was about this inescapable truth that any version of eternity is bad; you cannot design an eternity that is satisfying because when things go on forever everything loses meaning. We talked about that a lot in the show, and in the second season Michael had to have an existential crisis and confront the idea of death in order for him to have an understanding of what the hell they were talking about when they talked about moral decision-making. So when we were talking about them actually reaching the good place for real, it was like, ‘Well, the way to throw the curveball is that even when you’re in the actual paradise, if it goes on forever, everybody’s miserable.'”

Here, Schur talks with Variety about how the writers’ room came to the decision that choice is so important, even in the afterlife, if the new door is literal, and why this penultimate episode of the series was harder to crack than the finale.

What were the discussions or concerns about the politics around telling a story that allows its characters to choose when they will cease to exist in the universe?

I don’t think we had any, honestly. We recognized very quickly in discussing the story that this is echoing a real-life political and moral question that people face a lot and that has been hotly debated, but it’s not the first time that’s happened. A couple of episodes earlier when they’re trying to redesign the afterlife and Chidi [William Jackson Harper] is talking about that Judith Sklar essay “Putting Cruelty First,” he explicitly says there’s a problem in real-life moral justice — which is that people commit crimes that are not cruel and then their punishment is cruel. There’s an asymmetry there. That is very obviously and consciously attempting to be a discussion about criminal justice in America and elsewhere. And one of the most fun aspects of making this show is we had all of these guest lecturers come in to teach these classes, and when we were breaking that part of the season we had DeRay Mckesson come in and he talked about Black Lives Matter, he talked about criminal justice reform — and specifically the idea of how cruel punishments are in America for crimes committed that are in no way cruel. That was really intense and fun and interesting and gave us a lot to chew on. So we always start from the point of view of the characters and the world they’re in, but the fun part of the show is when it overlapped with real stuff because that’s when the rubber of abstract philosophy meets the road of real life. This was certainly one of those times.

Was there any opposition in the writers’ room to the idea that even in paradise if something went on forever it would end up spoiling?

There really wasn’t, in part because it was so baked into all of the other work we had done throughout the four years. Our “break glass in case of emergency and call this person” philosophical advisor Todd May wrote a book that was very formative for us called “Death” that was basically about the unsatisfactory feeling of immortality. And he cites a lot of philosophical works and also literal works — there’s a story by [Jorge Luis] Borges called “The Immortal” where this guy is searching for the fountain of youth and he keeps running into these homunculi, old, crippled creatures that are just wandering around endlessly in this maze, and he slowly realizes that those are people who have found the fountain of youth and have built this maze to stop other people from finding it because they are so miserable that they have to live forever. So from the beginning we’ve really felt like there’s no version of eternity that works. Todd says, in his book, that mortality gives meaning to our lives and then morality helps us navigate our lives. So this was a unanimous decision. I think we all had seen the essential truth of that and, by the way, not to get too deep in the weeds, but I had done a lot of reading very early on — before I wrote the pilot — about different religious conceptions of the afterlife, which are fascinating, and the one that stuck with me the most was in Hinduism the idea of karma and then in Buddhism, the idea where you’re a person who makes good decisions and you get good karmic chips in your account and then you’re reborn and you move up the ladder and you’re getting closer and closer to perfection — to nirvana — and eventually you nail it and you become a god. But then what happens is you’re not a god forever: you hang out but after awhile you use up that store of good karma and it starts over. Even in Hinduism, once you perfect the process of being a human, you don’t get to just chill forever in the perfect version. So we’re far from the first people to suggest that eternity is problematic!

Does the door have to be literal, or is it enough to allow these souls to think there’s that option?

Tahani says this — but their message is that they don’t have to go through that door, but just maybe the fact that you know it exists will have you enjoy your time more. I don’t want to spoil anything about the finale, but that was absolutely the idea of this episode: we’re just going to tell you there’s an option. The problem with how they were reacting to their surroundings was that they were trapped. It was the eternal version of golden handcuffs: everything is perfect, and there is no option for it not to be, and that becomes a bummer.

What is the temptation for you in the writers’ room, if it is a literal door, to have to see beyond it before the series ends?

That gets into the finale a little bit, but yeah, the first problem they have to solve is just that nothing like that exists. They have to create it, and then other stuff happens.

How did you come up with incorporating Hypatia, aka the titular “Patty,” into this episode as the one that opens Eleanor and Chidi’s eyes to the problems with paradise?

It’s funny because we knew going in that no one had gotten in in 500 years, so a lot of Chidi’s heroes were out. He’s also into ancient Greek philosophy, so we were like, “Who would be most likely to get in?” We went back and we looked at Aristotle and Socrates and Plato and Diogenes — and this person and that person — and the truth is is that as brilliant as those men were, a lot of what they did was defend slavery. There was a lot of slavery in ancient Greece, and there were a lot of — as always happens — powerful, entrenched structures that led to the great thinkers of the time being like, “No no, here’s why it’s fine.” And so we kind of did a survey of all of the philosophers that we knew, and we sent Todd and Pamela Hieronymi, who teaches at UCLA, an email that said, “OK, here’s the situation: On the DL if they got into the good place and there was one person from the ancient world — one thinker — that you think might have done enough to get in, who would that be?” And instantly both of them said Hypatia of Alexandria — who I had never heard of before, I’m not ashamed to admit. She was a real person, and she was a scientist and a mathematician and an artist and a philosopher and a great thinker and arguably the first real feminist of note, and she wasn’t pro-slavery. She was super cool and the more we read about it, it made perfect sense. And then it became very funny because the way to do this was to play it as the way some people may feel when meeting Zendaya or Angelina Jolie, that’s how Chidi is going to feel when meeting Hypatia of Alexandria, so it all kind of lined up perfectly.

When we designed the character we knew she had to be foggy-brained and carry that comedic tone, and Lisa was the only person that made sense for this. I used to work on “The Comeback” a million years ago, and I sent her an email and asked her if she could do it. She was vacationing with her family, ironically I think in Greece, and she was like, “This is is a sign.” So she came and did it and was delightful, as she always is.

Before they came to the idea about creating a door, Michael looked through the committee’s previous ideas to make paradise more exciting long-term, and one of them that stuck out on their whiteboard was “get more chocolate in chocolate.” Where did that come from?

I wish I could tell you; I can’t remember who came up with it. But the idea that in the good place they’re not human beings and don’t fundamentally understand the benefit of mortality, the idea was just that “more” was all they could come up with. It seemed like the perfect bad idea — maybe if we just made chocolate more chocolatey, that would somehow be satisfying. That was a good example of very simplistic thinking about what might be wrong with the people in the good place.

The episode ends on such a sweet moment, specifically for Eleanor and Chidi but still with the feeling that everyone will be OK and that there is still a lot of time they will spend together. What are the challenges then of wrapping the actual show up with a similar satisfying feeling in the next episode?

Finales are always hard and have pressure on them for various reasons, and we’re in this world — and have been for awhile — where not only is every show scrutinized, but people have this expectation that the finale is going to be the best episode, which is very funny. It’s almost impossible for that to be the case because it’s the end of something and finales have to do a lot of work that most average episodes don’t. But, to me, I think the hardest episode to break was this one because so much happens. They get to the good place for real, which is a thing you’ve been waiting for for four years! And then also there’s a huge problem that they have to solve and then we also have to set up what happens in the finale. So this was a hot topic of discussion the whole year: how do we put everything in place to get us to the point where we can do this episode well? We had a good sense of what the finale would be pretty early on, and we knew it would be a challenge for all of the reasons finales are challenging, but I was more worried about this one.

You not-so-long ago wrapped up “Parks and Recreation” by flashing forward in the finale to show where characters ended up. Now you have a show where characters are going to live out who knows how long with each other before stepping through a mysterious door. Did you feel pressure to flash forward with them, too, or was there concern about wanting to do things differently since they are such different shows?

A little bit, I guess, but every show is wildly different and they all have different themes and ideas floating around, and I think the show and its tone will always suggest what the finale should be. “Parks and Rec” was eternally optimistic in the face of a very pessimistic world — local government. The theme of the show was, “Put your nose to the grindstone, do the work, find good people that you love and can work with, and if you put in the work, ultimately, you’ll be rewarded, even if the reward is tiny. You have to cling to this tiny, little moments to feel like you did a good job.” I think the job of the finale of a comedy is to complete the deal that you made with the audience, which is to say, “We want to show you that the people you’ve hopefully come to care about and think about, you want to believe they’re OK.” That’s why for decades every romantic comedy in Hollywood ended with two people getting married; the hard work and day-to-day pressure of marriage are not what people are interested in in comedy. The marriage serves as the happy ending. “Don’t think about what happens next!” So you just sort of follow the themes of the show and concoct a finale that indicates everyone’s going to be OK. For “Parks and Rec” it made sense to jump through time to see how Leslie [Amy Poehler] had affected all of these people. We just did the same thing: we just said, “What story are we telling? What are the characters interested in, what have they been pursuing?”

“The Good Place” series finale airs Jan. 30 on NBC.