The bq27500/1 accurately predicts the battery capacity and other operational characteristics of a single
Li-based rechargeable cell. It can be interrogated by a system processor to provide cell information, such
as state-of-charge (SOC), time-to-empty (TTE) and time-to-full (TTF).

I had a quick look at the datasheet at it seems to be a very complex device that can (must?) be tuned to a specific battery by programming a lot of registers via I2C.