Image copyright Getty Images Image caption President Obama, shown in 2015, describes the rest of his tenure as the fourth quarter

With less than four months left in his term, President Obama and his aides are scrambling to get things done. Many are sceptical about what he'll be able to achieve.

Wearing a crisp shirt and colourful, striped socks, DJ Patil, the White House's chief data scientist, strode through a building near the White House. He seemed in good spirits, but he had dark shadows under his eyes.

Like many of his colleagues in the Obama administration, Mr Patil is both optimistic and exhausted by their effort to reach goals before the president leaves office in January.

They've embraced a "fourth quarter spirit", said Mr Patil, using a basketball metaphor that describes the last - and most exciting - part of the game.

Mr Obama likes to shoot hoops, and he adopted the metaphor himself for the final phase of his presidency.

Image copyright Getty Images Image caption DJ Patil is hurrying to finish projects before the president leaves office

Mr Obama seems confident he and his aides will accomplish a series of historic achievements during their final weeks at the White House.

"Remarkable things happen in the fourth quarter," Mr Patil told me.

The priority is getting Hillary Clinton elected so she can build on his work in office. Mr Obama is spending a day or two each week, campaigning on her behalf, until the election.

He'd like to do more than that, though.

He wants to improve treatments for cancer and send people to Mars (he's written a CNN piece about his interstellar plan, albeit a little vague on details).

Besides that he wants to fix the criminal justice system, close Guantanamo, secure a trade deal, the Trans-Pacific Partnership - and take back Mosul and Raqqa from the Islamic State group (IS).

All of these goals are fraught with challenges - whether geopolitical, scientific or legal.

Image copyright Getty Images Image caption Obama has been busy with last-minute tasks - and helping Hillary Clinton's campaign

The president's team have been "grinding away" at their effort to transfer detainees out of Guantanamo, said the American Civil Liberties Union's Chris Anders, who meets with the White House aides regularly.

By January, only a few dozen detainees may be held at the prison, but Republican lawmakers could still insist that it stay open.

Earlier this month, Obama gave more than 100 federal inmates a break, saying they could be released early - and underscored his ongoing effort to improve the criminal justice system.

Families hope for the mercy of a president

More inmates could have their sentences reduced in the coming weeks. But problems with the system remain.

Meanwhile administration officials speak in hopeful terms about the Trans-Pacific Partnership.

But support for the accord has dipped recently, and lawmakers are unlikely to vote on it while the president is in office.

US officials are also expressing optimism about taking back territory from IS. Even if Mosul and Raqqa were liberated, it's not clear what would happen afterwards.

Iraq and Syria are both unstable, and another militant group - or even IS in an altered form - could seize control of territory.

Image copyright Getty Images Image caption Obama, shown with former inmates, may grant clemency to more prisoners

For these reasons, the odds are against the president in his effort to secure lasting achievements during his final weeks.

Still, as Harvard's James Kloppenberg, a history professor, said: "He's doing what he can."

While Mr Obama and his aides have chosen a basketball term to describe their final weeks, most people employ a different metaphor.

"The term 'lame-duck presidency' is used for a reason," said Larry Berman, a University of California, Davis professor.

He said no president since 1932 had reached major legislative achievements during this part of their term.

In a tacit acknowledgement that the game is nearly over, some of the aides have left.

One office located upstairs in the Executive Office Building is now empty. A sticker that says "I Voted" still hangs on an old printer.

Here White House staffers talk about their plans after Mr Obama - and discuss job leads.

Image copyright Getty Images Image caption The president wants to close Guantanamo before he leaves office

But not everyone has given up the fight.

One senior official insisted that they're trying to "squeeze every ounce" out of the time they have left.

As Richard Stengel, a political appointee who's now serving as an undersecretary of state, reminded his colleagues during a presentation in Washington: "We all turn into pumpkins on January 19" - the date of the next president's inauguration.

He threw his hands in the air, showing how hard he and others have been working in the final weeks.

One of the questions, he said, was: "How do we keep the successes going - and hand it off to the next folks?"

Image copyright Getty Images Image caption Richard Stengel, shown with Ambassador Samantha Power, is pursuing last-minute goals

The stakes are high.

Sitting at a table in a second-floor office across from the White House, Mr Patil glanced at two mobile phones, both lying face down. They are a modern touch in a room that was used by cabinet officials in the 19th Century.

Mr Patil said he loved the room because of its history. When it came to projects, though, he is at the cutting edge of science.

One of the most important ones, he said, focused on precision medicine.

Can Obama's cancer campaign succeed?

Through the initiative, experts are gathering genetic data on Americans so that scientists will be able to design more effective treatments for cancer and other diseases.

Mr Patil described a young woman who has a serious form of cancer - and wrote a letter to the White House about her condition.

He called her from this room, he said, pointing to a phone on a nearby desk.

"She's in remission," he said.

For her, the work that Mr Patil and his colleagues are doing on precision medicine could mean the difference between life and death.

"We are in a race to figure out that next level of treatment," he explained.

That's why he and his colleagues are doubling down on their efforts - with frantic energy and a sense of near-paranoia.

"There's only two minutes on the clock," he said. "What can you get done?"

Mr Patil said he planned to stay till the end of the president's term, trying to accomplish as much as possible.

After that, his agenda is modest.

Standing in a hallway of the building, he described his immediate plans for a post-White House life:

"I'm going to take a good, solid nap."