How could I get the sum of market_cap based on country?

I want to get the sum of market_cap for each country.
And I'm trying to use the code

from sqlalchemy.sql import func
fundamental_df = get_fundamentals(
query(
func.sum(fundamentals.valuation.market_cap)