Has Nancy Pelosi finally cracked the code?

The image of the House Democratic leader striding out of the White House last week, casually putting on her sunglasses, broke the internet — and immediately became a meme of badass self-assurance.

Her triumphant exit had more in common with “Wonder Woman” than “The West Wing.”

The only thing missing is an explosion behind #Pelosi as she puts on her sunglasses and walks away, like in the movies. #NeverthelessShePersisted pic.twitter.com/vQnlKjfVfr — Theresa Jennings (@tjennings_art) December 12, 2018

Critics didn’t expect Pelosi, even if newly forged in a crucible of the triumphant midterm elections, to emerge as winner of the Oval Office showdown. But on live TV, she not only stood up to Trump, she corrected him, and asserted her own views. Then, after the president’s fumble, Pelosi labeled an impending government confrontation the “Trump shut-down.”

A rattled Trump also tried to demean Pelosi with jibes about her scrappy fight for the speakership. Pelosi did something few woman can — she declared her dominance with an unapologetic brag: “Don’t characterize the strength I bring to this meeting as the leader of the House Democrats, who just won a big victory.”

Pelosi asserted strength, which is inherent — not power, which is conveyed. In doing so, she emerged from the session as a boss, not merely a player.

That declaration was high drama. Pelosi asserted strength, which is inherent — not power, which is conveyed. In doing so, she emerged from the session as a boss, not merely a competent player. She was in charge.

In “Breaking Bad,” Walter White (played by Bryan Cranston) completes his transformation from high-school chemistry teacher to the all-powerful drug lord Heisenberg, when he demands that a rival speak his name as he crushes him into submission. Pelosi all but demanded of Trump, “Say my name.”

Today’s popular culture is replete with examples of women who, like Cranston’s Walter White, are protagonists because of their strength rather than their virtue. These female heroes on big screen and small set their own rules. Theresa Mendoza (Alice Braga) of the hit series “Queen of the South,” for example, builds her own drug cartel as revenge again a rival gang that killed her lover. But the power she now wields is as intoxicating as her revenge.

Abandoning normal expectations allows these women to rise above and control the masculinity of those around them. This new understanding of female power is based on iconoclasm. And as Pelosi demonstrated, it may now be bleeding into the world of politics.

Though badass women are now all the rage, the most famous template is Shakespeare’s Lady Macbeth, who delivers this chilling incantation: “unsex me here.” Stripping away what is expected of her womanhood is a necessary prelude to Lady Macbeth’s march toward power:

“Come, you spirits That tend on mortal thoughts, unsex me here, And fill me from the crown to the toe top-full Of direst cruelty.” (“Macbeth,” Act I, Scene V.)

Shakespeare shrewdly observes the way Queen Elizabeth I seized and maintained her power — never ceding her identity as ruler to her identity as a woman. Neither Lady Macbeth nor Elizabeth I played by the rules — and their power rests in transgression.

Perhaps no actor now embodies these transgressive heroines better than Charlize Theron. In “Mad Max: Fury Road,” her character, Furiosa, is a warrior whose ferocious fighting skills make her more than equal to any of her male antagonists. In “Atomic Blonde” Theron plays MI6 agent Lorraine Broughton, who wears a white mini-coat and thigh-high boots as she defies her handlers and takes down a deadly espionage ring.

None of these women play nice, but neither do they inhabit a nice world.

Much like Theron’s characters, Pelosi is demanding that the narrative be reconfigured on her terms. She has separated herself from the standard professional woman and the professional politician — the image she had spent a lifetime building.

Pelosi came of age with the rise of professional women. Manuals like the 1975 best-seller, “Dress for Success,” told women to adopt the male uniform of the well-tailored suit and discreet colors. Consider, a 1977 photograph of President Jimmy Carter’s Cabinet shows Housing and Urban Development Secretary Patricia Roberts wearing an unfortunate fedora and a “power-suit.”

This idea that the professional woman must conform to a set of male constructs still persists — virtually every version of “Law and Order” and “Madame Secretary” features female leads in pantsuits, making their cases in modulated voices. Pelosi herself has often masked her strategic skills with the camouflage of Armani suits and the careful language of compromise. But last week she revealed all in a fierce, burnt orange coat.

Perhaps, too, Pelosi has learned crucial lessons from Hillary Clinton. Clinton has often said one regret of her 2016 presidential campaign was not calling out Trump as he loomed over her during the second debate. Despite his bizarre choreography, Clinton remained the consummate professional, calm and composed. Pelosi, however, when confronting Trump’s attempts to unsettle her, was a badass.

Last week’s meeting might easily have been a repeat of the September 2017 sit-down, when Pelosi and Senate Democratic Leader Chuck Schumer thought they made a DACA deal with Trump over Chinese take-out at the White House. The Democrats played by the rules — only to have their agreement soon knocked down.

This time, Pelosi was prepared for the unexpected. The moment demanded not professionalism, but a declaration of strength. She was “Wonder Woman,” throwing off her cloak and striding fully armed — and alone — into World War I’s No Man’s Land.

What Pelosi had earned over a lifetime was owned in that moment. She was firmly in control — of the conversation, the setting and the narrative.