def get_fuels(collection, country):
   """
   Accumulate capacities for each fuel type for a given country
   """
   result = collection.aggregate([
      {
         # Search country
         '$search': {
            'index': 'default',
            'text': {
               'query': country,
               'path': 'country_long'
            }
         }
      },
      {
         # Accumulate capacity by fuel type
         '$group':
         {
            '_id': '$primary_fuel',
            'totCapacity': {
               '$sum': {'$toDecimal': '$capacity_mw'}
            }
         }
      }
   ])
   return result