LOS ANGELES — First Rambo and now 007?

MGM, the independent studio behind the James Bond franchise, is in “advanced talks” to sell the company to a Chinese buyer, a senior source said.

MGM, which also houses the archives of President Trump’s “The Apprentice,” has been looking for a buyer, or an IPO.

The firm is also a one-third owner — with Lionsgate and Paramount — of Epix, the premium movie and TV service.

The name of the China-based entity involved in the talks, perhaps newly formed to make the deal, could not immediately be learned. It is, however, the latest in a string of China investors looking for deals in Hollywood.

The film studio is owned by a slew of hedge funds including Kevin Ulrich’s Anchorage Capital Group and Highland Capital. Other investors include Daniel Loeb’s Third Point.

MGM emerged from a complex bankruptcy in 2010 whereby debtholders were able to convert their holdings into equity. The firm was loaded with $3.7 billion of debt at the time of its bankruptcy.

A deal with the Chinese entity could become complicated. Chinese nationals are having a hard time getting visas to enter the US, sources told The Post. The Beijing government is also cracking down on how much cash can leave the country.

Such rapid global changes are weighing on Dick Clark Productions, which made a $1 billion deal to sell itself to Wanda.

That deal is now all but dead, industry sources said.

A spokesman for MGM said “MGM is in the strongest position ever and is not for sale.”