Being Kevin McCarthy can’t be easy or very much fun these days.

He’s in the throes of a bruising congressional leadership fight. He’s being attacked — on Fox News! — for a cushy Washington living arrangement. He’s been scolded by his political mentor for his bended-knee devotion to Donald Trump.

And yet the Republican congressman from Bakersfield is precisely where he’s strived to be these past many years, just steps away from replacing Nancy Pelosi as speaker of the House. The GOP needs to gain only a handful of seats to win control in November 2022, and that outcome seems far more likely than not.

What’s striking is the pliability McCarthy has displayed to get where he is, thoroughly transforming his political personality and swiveling 180 degrees from positions he held just a few months ago.

All in the service of a dangerous lie — that the 2020 election was stolen — and to pander to the Trump-worshiping cult that constitutes the base of today’s Republican Party.

Why get hung up on principle when power is so near at hand?

In Sacramento, where he served in the Assembly, “McCarthy made a whole career of beating back the extremists,” said Mike Madrid, a former state party political director, who has known the congressman for decades. “And now that he’s close to achieving his goal, he’s essentially capitulated to them.”

It’s not unusual for a politician to shift views over time. Circumstances change. New facts emerge. Events make old ways of thinking obsolete.

But McCarthy’s turnabout has been so abrupt, you need a neck brace to avoid whiplash.

The day the House voted to impeach Trump for helping spur the violent assault on the Capitol, McCarthy opposed the move on procedural grounds. Too rushed, he said, and too inflammatory.

But McCarthy also said this: “The president bears responsibility for Wednesday’s attack on Congress by mob rioters.” The House Republican leader also batted away the nutty assertion that leftists in the guise of Trump supporters were to blame for the insurrection.

“Some say the riots were caused by antifa,” McCarthy said. “There is absolutely no evidence of that. And conservatives should be the first to say so.”

Since then, he has rejoined the ranks of Trump supplicants, minimizing the ex-president’s role in the onslaught and insisting that an independent investigation into the events of Jan. 6 include a probe of antifa and the Black Lives Matter movement.

His about-face has been noted by, among others, Liz Cheney, who is soon to be sacrificed on the altar of Trump veneration.

The Wyoming congresswoman’s original sin was holding Trump accountable by voting to impeach him for helping incite the Capitol rampage. With McCarthy’s help, Cheney easily survived a February effort by fellow Republicans to remove her as the GOP’s No. 3 House leader.

But since then, Cheney compounded her transgression by continuing to speak honestly about Trump’s culpability and his ongoing undermining of our democracy. Worse, she continued doing so even after other Republicans publicly wished she’d keep her mouth shut.

Cheney is likely to be ousted from the GOP leadership as soon as Wednesday, this time with McCarthy’s blessing. He, too, has gotten fed up with her truth-telling.

Like the overwhelming majority of House Republicans, McCarthy has gone along with the charade that Trump won the 2020 election, joining a frivolous lawsuit aimed at overturning the result and voting against certifying Joe Biden’s clear-cut victory.

“There was no fraud. The election was the cleanest election in history,” said Bill Thomas, McCarthy’s political mentor and the longtime Bakersfield congressman he replaced. Thomas suggested his former aide was a hypocrite, and noted McCarthy rejected the election outcome even after the House chamber was overrun and lawmakers had to run for their lives.

“It was as though they went to an extended lunch and came back and resumed their mission: Reinforce, by your votes, the lies of the president,” Thomas told journalist Robert Price in a TV interview on Bakersfield’s KGET.

It’s not hard to discern McCarthy’s reasoning. Over time he has proved himself exquisitely attuned to the Republican base and shrewd in his political positioning. When, after a few days, it was clear Trump would continue to reign supreme within the GOP — Capitol riot notwithstanding — the House Republican leader hied himself to Mar-a-Lago to show his obeisance.

McCarthy has never been policy-driven or particularly ideological. (The attack by Fox’s Tucker Carlson on his living arrangement — a below-market room rental in a luxury apartment owned by pollster and Trump critic Frank Luntz — plays into long-standing doubts about the congressman’s conservative cred.)

Above all, McCarthy is a climber, practiced at the art of attaining and boosting his power, said Mark Salvaggio, a former Bakersfield city councilman who endorsed McCarthy when he first ran for the Assembly in 2002. “He’s learned to change with the political winds.”

A kinder view is that McCarthy is simply being pragmatic and savvy, doing what is necessary as party leader to stay in the good graces of fellow Republicans and ultimately take back the House.

“He understands that to implement conservative policies, you have to control the government,” said Jim Brulte, who led Republicans in the state Senate in Sacramento while McCarthy was GOP leader in the Assembly. “He understands that winning elections is a team activity, and you’ve got to get that team going in the same direction.”

It’s uncertain what McCarthy would do as speaker, apart from working to thwart the Biden administration at every turn. No one has ever accused the Bakersfield lawmaker of thinking overly long or hard about a grand approach to governing.

But it’s clear what McCarthy will do to fulfill his long-standing ambition: anything it takes.