Mel Brooks famously said, “tragedy is when I cut my finger. Comedy is when you fall into an open sewer and die.”

He could have been describing a storyline out of one of today’s TV comedies or dramedies. In recent years, we’ve seen scripted programs find creative, often humorous, ways of attacking weighty topics ranging from PTSD and bipolar disorder to gentrification, prison violence, and abortion.

UnReal” co-creator Sarah Gertrude Shapiro says: “Cynicism by itself is boring, so [co-creator Marti Noxon and I] were like, ‘If we’re going to write this really dark show then it also has to be funny.’ And I think some other shows are also hitting the mark where, if it’s going to be dramatic, it also has to have some lightness and humanity to it.”

“UnReal” follows the goings-on behind the scenes of a “Bachelor”-like reality series, but the Lifetime show often finds itself addressing social and political issues. An eerily timed season two episode discussed police brutality toward African-American men days after the shooting deaths of Philando Castile and Alton Sterling.

Similarly, the penultimate episode of Netflix’s “Orange Is the New Black’s” most recent season delved into institutional problems in our penal system when a guard accidentally killed a beloved character.

Even more such traditional comedies as ABC’s “Black-ish” have explored the topic of police brutality, while the second episode of NBC’s “The Carmichael Show” was about the Black Lives Matter movement. Many of the “Orange” characters and all of the leads on both of these broadcast series are people of color.

“I honestly don’t think about it as far as race at all,” says “Carmichael Show” star and co-creator Jerrod Carmichael. “If we were an all-white cast, our Black Lives Matter episode would have probably been more interesting — note to Chuck Lorre.

“Obviously, it affects black people in a true, emotional way, but that’s not the reason why we do it. The reason why I wanted to write it is because it’s very interesting; it’s very American. That’s what America is going through right now and people can connect.”

Carmichael thinks “humor is best when it’s serious; why not delve into these real things? Why not talk about the things that we honestly talk about?” He adds that, when used correctly, multi-camera formats like his program “can be most intelligent, the most connective, the most in-your-face.

“We’ve seen so many bad versions of multi-cams. Probably most are bad because they don’t have fear and intensity. You can see it in the writing. I don’t think audiences are dumb and I won’t treat them that way.”

Not to be overlooked is that “Carmichael” and “Black-ish” have the opportunity to reach such a wide audience.

“I used to rebel against that idea because I’m a comedy writer and I just want to fucking be funny,” says “Black-ish” creator Kenya Barris. “But I do think that I have been really blessed and fortunate to have this show and I have heard the comments that have come from people on the outside. With that being said, I have opened up and I do feel there is some responsibility to try to be accurate and thoughtful with the conversations we’re having.”

Barris says there are some conversations, such as gang violence, that would feel contrived if they took place within the world of the show’s upper-middle-class household.

“We’re not ‘Law & Order.’ We’re not trying to be incendiary,” he says. “We’re trying to talk about what this family would organically be talking about.”

Instead, this season’s opener explored the evolution of the N-word while another episode tackled the ongoing debate about working moms and having it all.

Meanwhile, abortion — arguably the most polarizing and heated topic of them all — has been the catalyst for plots on such comedies as Showtime’s “Shameless” and Netflix’s “BoJack Horseman,” while “UnReal” has discussed domestic abuse. All three of those shows, as well as comedies like FXX’s “You’re the Worst” and Netflix’s “Orange” and “Lady Dynamite” have dealt with depression and mental illness, often from the points of view of female characters.

“I think for women to keep their sense of humor during tough times is sort of what it takes to be alive,” says “UnReal’s” Shaprio. “And I think that sort of aching humanity in all of these projects might come from the half of the population who has to put up with a lot of shit.”

Maria Bamford stars in “Lady Dynamite,” a series based on her own experiences with her diagnosis of depression and bipolar II disorder because, she says, “mental illness is hilarious in, of course, retrospect.” She argues that there is specific humor that comes from dealing with her condition while working in Hollywood.

“If it is something you can’t see, people assume it’s something you can fix yourself or it’s a character flaw if you can’t get out of bed or want to kill yourself,” she says. “The responses to people with illness, especially in Los Angeles society, are hilarious and so offensive: ‘It just sounds like you’re in an interesting place right now and be curious about it.’”

Bamford does regret that, because of its nature, it’s hard for her fairly autobiographical series to discuss how this diagnosis impacts those who are less fortunate than she is, and don’t have her type of career, support system, or income.

Shapiro wonders if the shared instinct among so many showrunners to tackle serious topics with humor “may be a response to the world being chaotic right now” because “it lends itself to shows that deal with that complexity.”

“In peak TV, the audience demands complex storytelling … they don’t want to be totally, morbidly depressed,” she says. “The news is really hard to watch right now, so shows that talk about what’s happening in the world right now but also have humanity and light in them are a welcome relief.”

She says “it’s a crazy, crazy high-wire feat” to bring the funny and the serious “because in one episode, we’ll go from comedy to sex scenes to a dark and political issue.

“The start [of an episode], for Marti and I, is humanity and if we interject humanity into all elements of the show, we can achieve this with the characters,” she says. “From the beginning, we felt that it was really an important opportunity to open up the idea that women who go on shows like ‘The Bachelor’ are humans. We felt that we needed to show bully TV and the culture created by those shows really can have a damaging effect.”

Still, no one wants to suggest that every show can benefit from its writers haphazardly picking a crisis of the week.

“If you don’t have real thoughts or views on it, you shouldn’t do it,” Carmichael says. “But if I have a real thought or perspective on it, I have to write it. Great art makes you feel and I like that. I like when people are a little uncomfortable. Dare I even say it, I like when people have to stay woke.”