SEX, death, race, religion — seemingly nothing’s off-limits to comedians.

Only one subject seems taboo, even for the likes of Louis C.K. and Chris Rock: the Holocaust.

Ferne Pearlstein, director of the documentary The Last Laugh, found this out the hard way when she had difficulty raising money for her movie.

“People told me I had a great idea and I should let them know when [other] people invested,” she says of her film, which premieres March 3 and focuses on humour in and out of the Nazi concentration camps.

It took her 18 years, but she raised the money for her modestly budgeted independent film, for which she corralled a Who’s Who of comics — Sarah Silverman, Carl and Rob Reiner, Gilbert Gottfried and Larry Charles among them — to speak about the unspeakable.

Mel Brooks, the man who wrote The Producers and its showstopping song Springtime for Hitler, explained where he draws the line: He mocks the Nazis, but considers the Holocaust itself off-limits.

Joan Rivers had no such boundaries: During 2013’s Fashion PoliceOscars wrap-up, she focused on Heidi Klum, quipping, “The last time a German looked this hot was when they were pushing Jews into ovens.”

Contemporary jokes about Hitler and his henchmen are put into perspective by the film’s most interesting revelation: Humour, however dark, helped some endure the misery of the camps.

“I went to a survivor who was the MC of a comedy show at Auschwitz,” says Pearlstein, whose family came to America ahead of World War II.

“These shows took place behind the barracks and prisoners told jokes that could have cost them their lives.” Pearlstein recalls the daughter of a survivor whose father told her, “If you were funny before the camps, you were funny in the camps.”

One of those she interviewed was Robert Clary, who played the French POW Corporal Louis LeBeau on the ’60s TV show Hogan’s Heroes.

A survivor of Buchenwald himself, Clary (born Robert Max Widerman) was criticised for appearing in a sitcom about a German prisoner of war camp (the “concentration” part went unmentioned).

Clary, who recently turned 90, told Pearlstein that entertaining under duress kept him alive.

“He lost his entire family [to the Nazis] and would not have survived if he couldn’t sing,” Pearlstein says about the actor, who kept his captors at Buchenwald amused.

“He was spunky and funny, and being able to make people laugh ... saved his life.”

This article originally appeared onThe New York Post.