In “Juno,” starring Ellen Page, Diablo Cody wrote an Oscar-winning screenplay about a snarky, expectant 16-year-old girl reaching parenthood before she reached high school graduation. With “Young Adult,” starring Charlize Theron, Cody focused on a depressed, divorced 30-something hellbent on winning back her former boyfriend whose wife just had their first child. Her dramatic focus in “Ricki and the Flash,” starring Meryl Streep, was a self-centered woman who abandoned her children to chase a dream of becoming a rock star. Her Emmy-winning Showtime series “United States of Tara” starred Toni Collette as a suburban mom with multiple personality disorder.

Four entirely different entertainments with a common thread binding them: motherhood.

We shouldn’t be surprised, then, that Cody’s new film, “Tully,” which opens Friday, is a portrait of modern motherhood, warts and all. It offers a crash course in postpartum depression, physical and emotional exhaustion, mom jeans, the mental gymnastics needed to operate as a family’s maid, trauma nurse, social secretary, chauffeur and chef, and the pang of saving the world daily and not coming home to a ticker-tape parade. On the other hand, there are occasional dashes of relief and joy.

In her second collaboration with Cody, Theron plays Marlo, a worn-ragged mother of two with a third on the way. Isolated and receiving little support in caring for her kids, Marlo is doing her best while clinging to a fraying strand of sanity. She is rescued when a new nanny, Tully, arrives like a Mary Poppins miracle worker, taking care of her as much as the new baby.

Motherhood is the cornerstone theme of Cody’s work, like Scorsese’s preoccupation with the Mafia. The main distinction, as she said in a phone conversation, is that her autobiographical connection to the material is far closer than his ties to the mob.

The motif of parenthood fascinated her from the start. “What’s so strange is my career began well before I had children,” she said. It started when Cody (born Brook Busey) moved after college from her Chicago home to Minneapolis, where she spent four years exploring her creative talents. It was a phase she describes as being “a 27-year-old knucklehead” pole dancer transitioning into a popular blogger, City Pages writer and acclaimed memoirist in “Candy Girl: A Year in the Life of an Unlikely Stripper.”

As for why maternal characters have become her creative inspiration, “It’s a tough question. I’d never even been pregnant when I wrote ‘Juno,’ so I had no idea.

“I think what I’m most interested in is how do our life events change us and how do we remain connected to the people who we once were. And for some reason, I guess as a woman, it feels like the most intense transition that has taken place in my life has been becoming a mother. So it just felt natural to write about that.”

It was also deeply personal subject matter. “Ricki and the Flash,” whose title character values a show business fantasy beyond the mundane requirements of ordinary life, “for me that was about professional guilt, let’s be honest. Worrying that I was pursuing my passion at the expense of my children.”

“Tully” is about a very different type of anxiety, she said.

“Am I equipped to be a caretaker? Am I a good enough mom? I guess these themes will continue to haunt me.”

The parental role is full of unexpected ups and downs, making the topic naturally attractive to Cody, who has had a lifelong addiction to riding extreme roller coasters.

In “Tully,” the turbulence of the lead character’s life is “definitely drawn from my own experiences,” said Cody, 37, the mother of three boys. An early high-speed montage of good intentions toppling like dominoes was entirely autobiographical, she said. Suctioning out mother’s milk that accidentally goes nonsterile before making it into breast-feeding bottles, nonstop diaper changes and wailing jags; “all of those things happened to me.”

The moments of marital distress between the new parents, however, “was fiction. This would have been a far less interesting film if Ron Livingston’s character had been as supportive as my husband is. I feel very fortunate to be doing what I love and have a lot of support. Being a mom in Hollywood is very different than what Marlo is experiencing,” which may explain why no notable movies about the challenges of postpartum life have appeared before this.

“If there is one, I haven’t seen it. It’s certainly underrepresented. I can’t name a film about it, and I know many women who have suffered from it. It’s something we should be talking about. It’s just another example of a female story that has not been told. I feel proud that someone might watch this movie and feel ‘Hey, I’m recognized.’ Because that was my whole reason for doing it.

”Supporting a family is a lot. I just feel like there’s so much expected of both men and women these days. Life used to be about survival. Now it’s like you have to be successful, you have to be attractive, you have to be sexually available, you have to be a caretaker, a great mom, a great dad. It feels like the expectations are off the charts. Sometimes I just want to be like the ’70s mom who sits down and lights a cigarette. I don’t smoke, by the way — that’s a metaphor.”

If a friend asked for her advice about having a child, “I would encourage them to do so but not to underestimate how much it’s going to change your life. You’ll never fully rest ever again. I know someone who described it as like a CNN ticker that’s constantly crawling across her head, and it never ends. It’s a really intense experience and people should be prepared for that.”

Cody normally doesn’t write films with specific actors in mind, “but this time I really, really wanted to re-team with Charlize Theron, and I really wanted her to do this movie. I’m so happy that she would. She’s fearless. As much as I love to write, I don’t always fully commit to things. I’ll have one foot in and one foot out. She commits fully to everything she does. She’s so brave and so raw.”

To play Marlo, she packed on 50 pounds so she can reveal her pudgy, after-childbirth belly to her grade school daughter, who asks, “Mommy, what’s wrong with your body?”

Cody has a hopeful attitude about films beginning to pay attention to women’s lives.

“I definitely have observed changes, no question about it. It used to be when I would pitch something that had a quote-unquote difficult female in it, people would push back. Or they would worry how not commercial it might be. Now people are actively seeking those kinds of stories. I think about a show like ‘GLOW’ on Netflix or ‘Orange Is the New Black.’ The fact that we’re seeing those shows is incredibly inspiring.

“But we’ve got a long way to go in terms of diversity and representation, still. Those are stories that I cannot tell as a white lady. I’m hoping that the people who can tell them will get the opportunity to tell them. Because we have a long way to go.”