This year’s election stories have been riddled with outlandish plot twists and Machiavellian protagonists who often act more like antagonists. And that’s not even including what’s happening on the scripted TV series that are supposed to be making this stuff up.

“On ‘Veep,’ we’re trying to find something that stretches reality to its edge, but could happen. And then, seven months later, these candidates are doing something like this,” says David Mandel, who this year took over as showrunner of the Emmy-winning HBO comedy about vice president-turned president Selina Meyer (played by Emmy winner Julia Louis-Dreyfus) and her staff. “I think we’re tapping into a certain amount of D.C. hypocrisy and sometimes headlines happen and it can be a wonderful or — if you’re an American citizen — horrible coincidence that politicians are doing things just like what we came up with on ‘Veep.’”

“Veep” has covered everything from the economic crisis to abortion, with a large portion of this season devoted to cleaning up last season’s cliffhanger: Selina’s reign may be temporary as it appears the election that would secure her seat in the Oval Office has ended in a tie.

“The cliffhanger was one of the more attractive things about the job when it was offered to me. It was just this delightful prison that I would have to escape from and the writer in me just sort of loved the challenge,” Mandel says. “I have to say, I would have probably just hate to be doing things that are similar to what’s going on in the real world. I’m glad I’m not doing debates in our season. I’m glad I’m not doing caucuses and endorsements and the people behind the candidate. Because that is exactly what is going on in the real world. ‘Veep’ is about the world of D.C. politics in general.”

Other series have chosen to hit the election head-on. Robert and Michelle King’s “The Good Wife,” which ended its term on CBS in May, chose to have the ethically challenged politico Peter Florrick (Chris Noth) campaign against real-life politicians like Hillary Clinton in a futile bid for the Democratic presidential nomination.

“The specter of Hillary Clinton running for president was certainly in the ether as ‘Scandal’ developed.”

Netflix’s “House of Cards” and ABC’s “Scandal” deliver all the surprise twists, meme-worthy soundbites and backdoor dealings audiences expect, but also carefully craft fast-approaching presidential races that would mean big changes for their lead characters. “Scandal” even brought back frequent foe Hollis Doyle (Gregg Henry), its favorite outspoken buffoon of a Texas lobbyist stereotype, to assume a Donald Trump-like presence this season.

“I think Shonda has her nose to the zeitgeist,” says “Scandal” star and frequent director Tony Goldwyn, of the impeccable timing and meta storytelling of series creator Shonda Rhimes. “She very much tends to anticipate what’s going on.”

Goldwyn plays Fitzgerald Grant on the show, a lame-duck president who also happens to be watching his ex-wife, Mellie (Bellamy Young), run for the Republican nomination.

“The specter of Hillary Clinton running for president was certainly in the ether as ‘Scandal’ developed,” he says. “As Mellie’s character started to take shape in the second and third seasons, I think Shonda started to realize that this was something worth exploring. As it all evolved, she’s very adaptive to everything in the world.”

Even series not set in the nation’s capital, such as Showtime’s “Shameless,” have offered passing jabs at the presidential race. But NBC comedy “The Carmichael Show” centered its entire second-season finale around it. Co-written by series star Jerrod Carmichael and Nicholas Stoller, the episode is called “President Trump,” but is non-partisan when it comes to jokes at the candidates’ expense.

“We as a writing staff, as the country has been, are fascinated by what is happening with the election and Trump,” says “Carmichael” showrunner Danielle Sanchez-Witzel. “We’re interested in the fighting that’s going on right now within the country and interested in politics as a topic. I’m sure we’ve all been at a dinner table and that’s the one [topic] that shuts it down. People get so angry about politics. Trump seems like a great way to tell a story about why do we get so worked up about politics? Why is that the hot-button thing? You don’t have to go further than Facebook to see how annoying it gets, no matter what side you take — pro or against whatever. It’s an interesting topic in an election year to explore and Trump gave us the hottest of hot buttons to pursue with our characters.”

Talking Heads: ABC hit “Scandal” found inspiration in current events as characters gear up for a big election.

But the actual timing of current events have rarely been on the side of scripted television. While Fox’s “The Simpsons” was quickly able to pull together a promo parodying Trump’s escalator ride to candidacy last year, the “Carmichael” writers had to debate whether to keep in a Ted Cruz joke even though the senator had dropped out of the Republican presidential race after their episode had filmed. Also, says Sanchez-Witzel, “we definitely had to be careful even discussing [Democratic candidates] Bernie [Sanders] and Hillary, no matter whether they will both make it to the [convention].”

Politicos themselves have also gotten creative this year. Trump, Sanders and Clinton all caused fanfare when they appeared on episodes of NBC’s “Saturday Night Live.” Clinton also cameoed on an episode of Comedy Central’s “Broad City,” a series executive produced by Amy Poehler, who famously portrayed her on “SNL.”

There is also the issue of accuracy, particularly with the intricacies of a political nomination and the voting process.

“We’re professional actors and writers, so we do our homework,” Goldwyn says. “But absolute faithfulness to those kinds of details are not [an issue]. Shonda’s a very knowledgeable woman. When she’s departing from accuracy, that’s a deliberate choice. It’s not sloppy.”

Hollywood, by its nature, is also a place where people have a platform to voice their opinions and these views often seep through into scripts.

“I find everything that is going on in politics these days absurd, so I think it lends itself to comedy,” says “Veep’s” Mandel. “What’s going on is nutso right now. What’s been going on in the last eight years is nutso. While we are a comedy and that’s nice, we have a very specific take on the pulse of Washington and what the people are like in Washington. It’s not about positions on issues. It’s about people who worry about taking the right position so that other people think they’re taking the position. Comedy or drama, I think our coverage of Washington is frighteningly realistic. That’s what makes our show fun to write.”

Hopefully “Veep” is more realistic than “BrainDead.” The new series from the “Good Wife” creators launches this summer on CBS and stars Mary Elizabeth Winstead as a congressional staffer who learns aliens have been making meals out of the brains in Washington. Those jokes almost write themselves.

Rob Owen contributed to this report.