LOS ANGELES (Reuters) - At age 81, and with a terminal cancer diagnosis, U.S. Senator John McCain is looking back on his life, not with rancor or to settle old scores, but with immense gratitude.

“John McCain: For Whom the Bell Tolls,” an HBO documentary premiering on May 28, takes its title from the Ernest Hemingway novel that McCain says he has used as a guide for his life.

“The world is a fine place and worth the fighting for, and I hate very much to leave it,” begins the documentary, quoting from the 1940 novel about a young American who fights in the Spanish Civil War for a cause greater than himself.

“You will never talk to anyone who is as fortunate as John McCain,” says the six-term senator from Arizona, two-time presidential candidate and Vietnam War hero, summing up his life.

The documentary, and a memoir published on May 22 called “The Restless Wave,” were conceived before McCain was diagnosed with brain cancer in 2017.

It features home videos, personal photos, interviews with his family and friends and contributions from leading Republican and Democrat supporters and rivals, including former presidents Barack Obama, Bill Clinton and George W. Bush.

The film also traces McCain’s many political battles, often pitting him against his own Republican party, on issues ranging from campaign finance and immigration reform to human rights, climate change and pleas for civility and compromise rather than partisan politics.

Slideshow ( 2 images )

“I am reluctant to call it a last testament, although it has that quality, obviously,” said Mark Salter, McCain’s aide, speech writer and friend of 30 years.

“More than anything else, it’s an expression of his gratitude to his country for the opportunity to live the extraordinary life he has lived in service to it,” Salter told Reuters.

While “The Restless Wave” sees McCain criticizing President Donald Trump for a failure to uphold U.S. values, Trump is never mentioned in the documentary.

Salter said the film aims to rise above feuds and provide an “honest look at his life, his imperfections as well as his virtues.”

McCain admits on camera that he can be short-tempered and a perfectionist.

As for his health, Salter said McCain fought off an infection a couple of weeks ago “and is working on getting his strength back.”

“I know it’s a vicious disease,” McCain says in the film. “I greet every day with gratitude.”