(Julia Louis-Dreyfus photograph courtesy of HBO/Lettering by James Victore/Production by Gene Bresler)

On Nov. 8, as the nation picked its 45th president, Julia Louis-Dreyfus spent the night observing a fake election.

The scene, filmed for an upcoming episode of the political comedy “Veep,” unfolded in what was supposed to be a polling station in a post-Soviet republic. Actors dressed as villagers — wool caps, scarves, an unruly chicken tucked under an arm — ambled across the set to dip their fingers in ink, as Louis-Dreyfus, in character as ex-president Selina Meyer, kept watch.

Poor Selina Meyer. She had hoped to become known as a transformational leader like Reagan or FDR, but, after losing her bid to keep the White House, has been relegated to promoting fair elections abroad, like some sort of female Jimmy Carter.

“Traveling the globe,” as she puts it in one scene. “Spreading democracy like Patient Zero.”

While Louis-Dreyfus presided over the make-believe contest, the cast and crew checked their phones to keep tabs on the real one. Like many, they fully expected Hillary Clinton to prevail; a writer had even brought a large U.S. map, with plans to color in the states as they went blue.

When Donald Trump started racking up victories, the map ended up in the trash, and a sense of shock fell over the set. While Clinton wouldn’t speak publicly until the next day, Selina Meyer seemed to be speaking for her that night. One line of dialogue, Louis-Dreyfus later recalled, felt especially relevant:

“Ugh, democracy,” Selina sighed. “What a f---ing horror show.”

For five seasons the HBO sitcom has deftly parodied Washington, D.C., reveling in the pettiness, the naked ambition and, often, the idiocy of the nation’s capital. But now there’s a President Trump. And he and his administration have done a bang-up job of showcasing the peccadillos of our swampy little town on their own.

As such, they’ve made it increasingly difficult to differentiate a “Veep” plot from a real-life one. We’re now in a world where the president repeatedly insists that a record-breaking crowd attended his inauguration, when photos of the event clearly show that the Mall, barely one-third full, was dwarfed by the turnout for Barack Obama’s 2009 swearing-in; and the White House press secretary says things like, “I gotta be honest, the president went out of his way to recognize the Holocaust.”

Not only has the psychodrama of this White House become its own must-watch TV, it’s also raised an existential question for the makers of “Veep”: What happens to your political satire when the real world has gotten crazier than anything you could have imagined?

The show, which returns to HBO on April 16, has been wrestling with this dilemma since the Trump phenomenon exploded last year. But for Louis-Dreyfus, a complicated election night made at least one thing simpler: channeling the rage that drives Selina Meyer.

“It made it easier to perform,” she said. “It scratches a deep itch for me to satirize or be funny about something that maybe doesn’t seem funny at all.”

(Ashleigh Joplin,Jorge Ribas/The Washington Post)

‘Veep” is the story of an opportunistic, short-tempered vulgarian who by sheer determination and blind luck rose to become president of the United States.

It’s also the story of the pressure cooker of politics, and the people who — out of a desire for power, reputation and, in some cases, idealism — are drawn to it.

“It’s the most accurate show on television,” said Martin O’Malley, the former Maryland governor who ran a hapless campaign for president in 2016 and is toying with the idea of running again in 2020. “That’s what it’s like.”

The makers of the show take great pains to get it right. They have become Jane Goodalls of the capital, embedding with White House and Hill staffers to study mannerisms and motivations. They take meetings with the bigwigs — Joe Biden, John McCain and Al Franken, to name a few. Last summer, in preparation for a season in which Selina will be coping with the aftermath of her electoral loss, they brought Mitt Romney to their offices to pick his brain.

Through their research, they were able to make “Veep” into Washington’s favorite funhouse mirror, a place for politicos to gaze at slightly warped versions of themselves and their colleagues.

“I’ve met a lot of people who tell me there’s a Jonah in their office,” said Timothy Simons, who plays Jonah Ryan, a puffed-up ignoramus with a knack for failing up. “None of them, however, ever admit to being the Jonah.”

The show has bipartisan appeal (Supreme Court colleagues Elena Kagan and the late Antonin Scalia used to watch together) and can feel so real that it’s become a cliche to say that Washington, where incompetence often outweighs malevolence, is more “Veep” than “House of Cards.”

For all the scathing realism of “Veep,” though, its creators have had to apply heavy dollops of farce to get the laughs and keep the plot moving. In the last season alone, President Meyer accidentally tweeted private love notes to her boyfriend, then tried to blame Chinese hackers; had a pimple so massive it triggered a stock market sell-off; and lost a deadlocked election after a tiebreaking vote from the House of Representatives.

And yet ... even “Veep” couldn’t have pulled off staging a Moscow hotel sex romp.

That’s what David Mandel, the executive producer and showrunner, remembers thinking in January, when unverified claims involving the president emerged in a dossier compiled by a former British intelligence agent and were taken seriously enough by U.S. intelligence officials that they warned Trump that the Russian government could have compromising information about him.

“It out-Veeped ‘Veep,’ ” he said during a lunch break on a recent day of filming in a Beverly Hills mansion. “It doesn’t even matter if it’s true or not. The fact that everyone is talking about [this] is just madness.”

He was sitting at a 10-person dining room table, set with white china and candles for a scene they were preparing to shoot, and holding forth on the challenge to say something “revealing about politics when politics has changed so much.”

Tony Hale and Julia Louis-Dreyfus as Gary Walsh and Selina Meyer. (HBO)

Members of the cast and crew flitted about nearby, plotting the precise comic timing with which to deliver their curse-laden diatribes. Louis-Dreyfus showed an actor who would be preparing food in the scene how an experienced chef would chop vegetables. When the cameras rolled, writers watched from a screen in a nearby room — holding in their laughter, like opera patrons suppressing their coughs, until the scene ended.

“Maybe this is a good thing for ‘Veep,’ ” Mandel said of the current political environment. “It’s forcing us to be more clever.”

“Veep” has a history of not only drawing from real events, but predicting them. There was the time Selina adopted a hilariously vapid campaign slogan, “continuity with change”; a year later, back in the real world, Australian Prime Minister Malcolm Turnbull kept trying to make his catchphrase “continuity and change” happen. And when Vice President Pence was kept in the dark for two weeks about then-national security adviser Mike Flynn’s meetings with Russians, “Veep” writers laughed to themselves about how Vice President Meyer used to start each day asking if the president had called. (He never had.)

“Our show started out as a political satire,” Louis-Dreyfus said at the 2016 Emmys in September, as she accepted her fifth consecutive award as outstanding lead actress in a comedy series for her “Veep” role. “But it now feels more like a sobering documentary.”

Had she won a Golden Globe this year, Louis-Dreyfus had another joke prepared. Given her show’s track record of foreseeing the future, she planned to say, maybe they could nudge history in the right direction by making the next season about a skilled and competent president who never stoops to petty social media feuds.

In reality, the creators of “Veep” are resisting the urge to overreact to Trump. They haven’t based a new character on him. It’s possible, Mandel said, that writers may draw from real-life events, but you’ll see it only in passing references. The show has never identified the political party of its main characters, nor has it mentioned by name any politician who existed after Ronald Reagan. It has created its own world for itself and isn’t about to stray.

In that sense, they feel lucky that their show has moved out from the presidency.

“If Hillary was in the White House and Selina wasn’t, I might be sitting here thinking what an idiot I am to have missed this opportunity,” Mandel said.

Instead “Veep” can double-down on a belief that even if the parameters of acceptable behavior seem to have shifted with Trump, the essential truths about D.C. remain the same.

“I don’t know that it’s that different to poke fun of” Washington now, Louis-Dreyfus said. “It’s still filled with idiots.”

Timothy C. Simons as Jonah Ryan. (HBO)

Jonah Ryan, a character whose smugness is surpassed only by his incompetence, won a congressional election last season and used his victory-night speech to berate his haters from high school.

“Hey, Jessica,” he sneered, gripping the lectern in what was supposed to be a New Hampshire gymnasium. “I like what you did with your hair. You like what I did with my life? Jimmy O’Connor, I’ve been waiting 20 years to say this to you: I’m not the spaz. ... I think that you are the spaz.”

It was the kind of cathartic moment that many dream of but only the truly spiteful follow through on.

“This is my dream,” Jonah concluded. “That you can believe in yourself so hard that you eventually become a congressman.”

At 6-foot-4 and lanky, Simons plays Jonah as a big man without any stature; a character that people look down upon even as he looms above them.

“Jonah kind of is the Trumpiest person,” Simons said. But no “Veep” character is based on just one person. Selina, for example, has some Hillary Clinton in her, but there’s some Al Gore, Colin Powell and Dick Cheney in there, too. For Simons, his inspiration comes not from Trump, but from Ted Cruz, the Republican senator from Texas who ran for president last year. “Cruz is like a poorly designed robot, made to be social but programmed by someone who read the manual backwards,” Simons said.

On this day, Simons had two scenes as Jonah, the first at a studio on the Paramount lot mocked up to painstakingly resemble the fifth floor of the Cannon House Office Building — famously the worst offices in the Capitol — followed by a second at the Beverly Hills mansion.

“You know what the craziest thing in the entire world is?” he said between takes. “Trump could probably learn a bit about a sense of decorum from Jonah. Isn’t that so messed up?”

It’s been a rapid rise, not only for Jonah, but for Simons, whose most notable credit before “Veep” was as an overly honest Abe Lincoln in a Geico ad, admitting to Mary Todd that her dress made her look fat.

Now, when not in character skewering a certain kind of slimy Hill climber, the actor is positioning himself as a smart-aleck critic of the administration. His Twitter feed attempts a high-low balance — one day wryly proclaiming that “America feels much safer now that these middle aged parents who built lives here have been deported and separated from their families,” on other days just flinging expletive-laden insults at the president.

“You drunk-tweet a lot,” Louis-Dreyfus said to him. “But you’re good at it.”

Julia Louis-Dreyfus in “Veep.” (HBO)

It’s almost inevitable for actors on a political TV show to find politics become a part of their real lives.

Louis-Dreyfus said she has been approached by top Democrats and asked to run for office. (Not in a million years, she said she told them.) Reid Scott, who plays cutthroat staffer Dan Egan, went to the Democratic convention in Philadelphia last year, where he was warned he might get asked about policies he knows nothing about. And after a recent tweet storm, Simons said he was invited to appear as a guest on a cable news show. (He said he declined, in vulgar and vehement terms.)

Even the show itself serves a real-life political purpose. “Maybe now more than ever,” said Armando Iannucci, the Scottish writer and director who created “Veep” in 2012, “it can keep people concerned about what’s really going on in Washington. It can show you how things can happen just because of stupid little errors. That could at least keep the electorate alert.”

It’s a responsibility that Iannucci, who left the show after Season 4, said he’s happy belongs to someone else. “I’m so troubled by all that’s going on,” he said. “I’d be worried I’d be too depressed to make anything of it.”

The surreal nature of the Trump campaign and presidency affects many comedies beyond “Veep.” “Saturday Night Live” has leaned into its knack for political comic impersonation, enlisting Alec Baldwin to play the president, eviscerating press secretary Sean Spicer with a rabid Melissa McCarthy portrayal, and helping keep presidential adviser Kellyanne Conway a household name. The creators of “South Park,” on the other hand, have decided to veer from Trump satire altogether. It was getting too hard, they said, to differentiate satire from reality.

For the “Veep” team, the calculations are trickier. They can’t keep up with the news like SNL, but they also can’t just pretend the world of politics is the same as ever.

“We have a show about politicians getting caught up in their own gaffes, and now we live in a world where there is no gaffe big enough,” said Simons. The worst thing that could happen to “Veep” would be for it to appear quaint by comparison to the real world.

Yet this could also be the best possible climate for “Veep” since it premiered. Never before has there been so much interest in the palace intrigue of Washington, and never before has the place been so ripe for ridicule.

“If anything, I’m thinking the audience will be larger,” said veteran Washington news producer Tammy Haddad, who is a consultant on the show. She points to the soaring ratings and Web traffic for politics-obsessive outlets ranging from SNL to Vanity Fair to The Washington Post. “I predict twice as many people will be watching.”

Gary Cole. (HBO)

Kevin Dunn. (HBO)

Kevin Dunn, who plays Selina’s former White House chief of staff, learned of Trump’s impending victory in the same place many people in Los Angeles did. Stuck in traffic.

He remembers driving home from filming, hearing the sheer disbelief coming from the voices on the radio and seeing it on the faces of his fellow commuters. But Dunn had spent years immersed in the nastiness of politics for his role on “Veep.” The idea that voters might be interested in an outsider like Trump vowing to blow everything up didn’t seem far-fetched to him. “It’s just so bitchy,” he said about the modern state of politics. “There’s not a lot to like.”

“I wasn’t shocked,” agreed Gary Cole, who plays the show’s cocky data guru, Kent Davison. “It’s clear there was an opportunity, a vacuum in leadership, and Trump seized it.”

People watching “Veep” and people attending Trump rallies may have the same takeaway: Washington is the worst. Who wouldn’t want to drain the swamp of Selinas, Jonahs and Dans?

But then again, the Trump administration has done a lot to validate the worldview of “Veep.” For all the talk of changing the way things are done in D.C., plenty seems to be staying the same. The president still stocks his Cabinet with Goldman Sachs veterans, poaches his top staff from the ranks of party operatives and populates the West Wing with underpaid young people scrambling to find which receptions come with a free meal.

Ultimately, these unchangeable truths about Washington are what make “Veep” a successful comedy. They’re also what make the place a f---ing horror show.

Ben Terris is a writer in The Washington Post’s Style section with a focus on national politics. To comment on this story, email wpmagazine@washpost.com or visit washingtonpost.com/magazine.