David Gergen has been a White House adviser to four presidents and is a senior political analyst at CNN. A graduate of Harvard Law School, he is a professor of public service and director of the Center for Public Leadership at the Harvard Kennedy School. James Piltch is Gergen's chief research assistant. His writing on civic life and education has appeared in The Washington Post, The Boston Globe, and The Chronicle of Higher Education. The opinions expressed in this commentary belong to the authors. View more opinion on CNN.

(CNN) If she were in the market for the job, it is now clear which Democrat would have the best chance of beating Donald Trump in 2020: Nancy Pelosi.

What a dramatic turn of events Pelosi has engineered since Trump rose to power. Not so long ago, she was a political punching bag for Republicans. They ran political ads all over the country morphing the pictures of Democratic candidates into images of Pelosi and issuing stark warnings to voters that any Dem running for the House would be a Pelosi stooge. Even some of her own members preferred fresh leadership as Trump took office.

Now, however, she is enjoying not only a last laugh but also a major comeback—mostly because she has been more successful than any other Democrat at outmaneuvering and often outfoxing President Trump.

With the nation's attention riveted on her as she has guided the impeachment inquiry, she has been at her absolute best—keeping an ideologically diverse and at times unruly caucus largely satisfied while not allowing impeachment fervor to overcome her governing or judgment.

But what Pelosi has done outside the realm of impeachment also deserves acknowledgment. Under her leadership, the Democrat-controlled House has passed a number of significant bills—ones that would protect voting rights, take needed action on climate change, address gun violence and help achieve equality for LGBTQ Americans.

JUST WATCHED Nancy Pelosi walks tightrope in impeachment probe Replay More Videos ... MUST WATCH Nancy Pelosi walks tightrope in impeachment probe 02:33

These bills have all died in Mitch McConnell's "graveyard." But the 400 bills the House has passed ( with 80% of them still languishing in the Senate , Democrats say) should help Democrats drive home a point in 2020: if Americans are angry about nothing getting done in Washington, they shouldn't put all the blame on the Democrats.

Perhaps more importantly, given the way Republicans routinely let Trump off the hook, Pelosi has repeatedly gotten the best of the President in very public ways. During the shutdown one year ago, she put Trump in a very public corner— an Oval Office meeting before reporters and cameras -—where he conceded he would own the shutdown. Notably, the only time Trump has been below 40% approval for an extended period since his first months in office was during that shutdown.

She also walked out on the President in October after he reportedly had a "meltdown" during a meeting with Democratic leaders. While the photo of her standing up to him captured attention and praise, he tweeted it as an insult of her that night — a choice that probably did not help his already rocky standing with suburban voters.

With impeachment, she has brought these abilities—to govern and to tussle with the President—into near-perfect alignment. When the Mueller Report did not provide an easily explainable smoking gun, and so did not move the country, she resisted Democrats who wanted to move forward on impeachment.

Even as the list of such members grew, she did not put either those who did want impeachment or those who did not into a box. That is, she let individuals speak out but did not hold a vote that would put those who were unsure in an impossible situation. She was wise to be patient and cautious.

Then, when details of the Ukraine call were revealed and the evidence of impeachable behavior was persuasive, she moved quickly and effectively, launching the inquiry. A majority of Americans soon came to support the need for the inquiry (though it appears unlikely that Democrats will make people also support removal as decisively.)

Aware that the House Judiciary Committee was full of Republicans who enjoy a partisan brawl, and also confident in the talents of Intelligence Committee chairman Adam Schiff, she had his Intelligence Committee take over the impeachment investigation.

Now, on a day that will live in memory, Pelosi has pulled off a two-step: Democrats announced the articles of impeachment, calling out the President for abuse of power and obstruction, and just an hour later, announced their support for a major trade deal that Trump had sought.

While Democrats considered having an article related to Trump's obstruction that was detailed in the Mueller Report, Pelosi kept the focus on Ukraine, because that is what the country appears to care about and what her members support.

Meanwhile, with the trade deal—the United States-Mexico-Canada Agreement—Democrats appear to have gotten most of what they wanted, and Pelosi has given her moderates something to sell back home (and she may offer another victory for Democrats with the prescription drug bill this week).

Trump could clearly claim a victory, too, on North American trade, but who thought Pelosi and Richard Neal (D-MA) would pull off an AFL-CIO endorsement of their actions? (The union is allied with Democrats on most issues, of course, but parted ways on the original NAFTA agreement.)

Get our free weekly newsletter Sign up for CNN Opinion's new newsletter. Join us on Twitter and Facebook

Pelosi has not had a perfect record in the last two years. She has had some scraps with members of her own caucus, making news and distracting from the bigger issue of holding Trump accountable. However, she may well be the only politician who has both personally and politically stood up to a President seen by many as corrupt, even as she achieved legislative accomplishments that have the potential to help a significant number of Americans.

By moving so quickly with impeachment, she's making it clear that a President should be held accountable and that elections must be transparent and fair, while also guaranteeing that in the runup to next November, Democrats have time to focus on key issues, such as health care costs. ( Please see a shocking story in The Washington Post showing that the percentage of Americans who cannot afford medical care has doubled in the past three decades.)

Americans may remain unsure who should be the next President. But it's clear Democrats already have their best possible choice for Speaker of the House.