When Jennifer Lopez took her fiancé Alex Rodriguez to a strip club in Miami this past winter, it wasn’t just her way of bringing some pizazz into the relationship.

It was homework, under the tutelage of Johanna Sapakie, the pole-dancing guru who taught the 50-year-old how to effortlessly writhe and twirl for her role as a veteran stripper in “Hustlers,” out Sept. 13.

“I told her, ‘You need to go, and feel what that is,’ ” says Sapakie of Lopez and Rodriguez’s strip-club jaunt. “That really informed our sessions. Jennifer doesn’t want to guess — she wants to know.”

Sapakie, a muscular, powerhouse acrobatic dancer of more than 20 years, choreographed and trained Lopez for the movie, which follows a troupe of cunning strippers at the fictional Hustlers in New York as they scam their Wall Street clients. Along with Lopez, Sapakie also worked with the star-studded film’s other actresses, including Lili Reinhart (“Riverdale”) and Constance Wu (“Crazy Rich Asians”). But in the run-up to the film’s wrap, Sapakie devoted most of her expertise to Lopez, who had a pole installed in every city she visited for their rigorous coaching sessions, which lasted two-and-a-half months.

“We would stick trainings in anywhere in the day it would fit,” says the Vegas resident, who earned her stripes with Cirque du Soleil and has been working with Lopez on and off as a choreographer for the past five years.

Of course, her job was made easier by the fact that Lopez already has the kind of dancing cred other performers could only dream of — not to mention a body that happens to already look good in a stripper’s uniform, Sapakie says.

“You don’t wear a lot when you pole dance,” she says. “But she’s got a legendary body.”

In the movie, Lopez plays Ramona, the aged-out matriarch of the strippers at Hustlers. The based-on-real-life story has her orchestrating a comeback for her fellow strippers after the 2008 financial crisis, when the girls resorted to extreme measures to bring cash in, including drugging would-be clients so that they would spend more money (and also not remember doing so). Lopez’s pole-dancing swagger had to be convincing on-screen, because the script called for her to teach the other girls how to do the moves she had only just learned herself.

“Obviously she’s a phenomenal dancer, so she has that in her pocket, but she had never done pole dancing before,” Sapakie says. “So it was a crash course in: ‘What does she need to know for this film?’ ”

In the trailer for the movie, Ramona is seen showing younger dancer Destiny (played by Wu) how to do a knee hook, ankle hook and what Ramona calls the “carousel” — a dazzling spin around the pole while seductively whipping around a long ponytail. Those were some of the earlier lessons in Lopez’s training, Sapakie says, culminating with an inversion, or hanging upside down with one’s ankles holding the pole.

“We wanted to have one ‘wow’ moment,” says Sapakie. “But that, if you’re not used to it, can take a moment to feel safe.”

‘You don’t wear a lot when you pole dance. But she’s got a legendary body.’

Not all the characters needed to master such wow moments though. With Wu, for instance, training was mostly about getting her comfortable on the pole — although the “Fresh Off the Boat” star also visited a strip club in LA to prep for the role.

“[Wu]’s character is more of a newbie,” Sapakie says. “So having her look like a new artist worked for her character. She should not appear like she’s been doing this for a long time.”

Other actresses, such as Reinhart and actress-singer-presenter Keke Palmer, got an introductory session with Sapakie — learning “how to spin around and have fun,” so they would look natural in the strip-club scenes, Sapakie says. “With them, it was more like girls having a party.

“But [Reinhart] enjoyed it so much, she came back and had a private session with me because she just wanted to learn more,” Sapakie says. “That’s how it works — you try it once, and you fall in love with it.”

Sapakie’s pole-dancing experience is strictly clothed, but her body is a testament to the athleticism required for the dance form. In the years since she took up pole dancing, she’s seen its reputation go from strip-club moneymaker to an honest-to-God workout routine even suburban moms can get behind. She’ll bring a couple of her classes from Sin City to New York this month, starting with a beginner’s class on Aug. 20 at Body & Pole in Chelsea from 8:30 to 10 p.m.

Lopez, who did all her own moves in the flick, said on “Jimmy Kimmel Live!” that the style of dancing was one of the hardest skills she’s ever had to learn: “I have a lot of respect for people who do the pole,” she told the host. “It’s much more difficult than [professional dancing]. It’s different muscle groups, and the things they do with their legs, [going] upside down, I’m like, ‘What?’ ”

“But you’re gonna see her on camera and have no idea it was ever a struggle, because she freakin’ nails it,” Sapakie says.

Proof of that process is what Sapakie affectionately calls “pole kisses,” or “the bruises you get when you’re pole dancing.”

So did Lopez get any of these smooches?

“Uh, yeah,” Sapakie says. “But she doesn’t shy away from that kind of stuff. If that’s what it takes to get the work done, she’ll do it.”