2015-04-22

This code analyzes the number of speakers in major languages based on per capita income of speakers as adjusted for local cost of living. The output contributes to a survey of best foreign languages for an English speaker to learn. The data tables were updated from the IMF World Economic Outlook database released in April 2015.

#! /usr/bin/python
# -*- coding: UTF-8 -*-

import re, sys

countryCodes = {
	'AFG' : 'Afghanistan',
	'ALB' : 'Albania',
	'DZA' : 'Algeria',
	'AGO' : 'Angola',
	'ATG' : 'Antigua and Barbuda',
	'ARG' : 'Argentina',
	'ARM' : 'Armenia',
	'AUS' : 'Australia',
	'AUT' : 'Austria',
	'AZE' : 'Azerbaijan',
	'BHS' : 'The Bahamas',
	'BHR' : 'Bahrain',
	'BGD' : 'Bangladesh',
	'BRB' : 'Barbados',
	'BLR' : 'Belarus',
	'BEL' : 'Belgium',
	'BLZ' : 'Belize',
	'BEN' : 'Benin',
	'BTN' : 'Bhutan',
	'BOL' : 'Bolivia',
	'BIH' : 'Bosnia and Herzegovina',
	'BWA' : 'Botswana',
	'BRA' : 'Brazil',
	'BRN' : 'Brunei Darussalam',
	'BGR' : 'Bulgaria',
	'BFA' : 'Burkina Faso',
	'BDI' : 'Burundi',
	'CPV' : 'Cabo Verde',
	'KHM' : 'Cambodia',
	'CMR' : 'Cameroon',
	'CAN' : 'Canada',
	'CAF' : 'Central African Republic',
	'TCD' : 'Chad',
	'CHL' : 'Chile',
	'CHN' : 'China',
	'COL' : 'Colombia',
	'COM' : 'Comoros',
	'CUB' : 'Cuba',
	'COD' : 'Democratic Republic of the Congo',
	'COG' : 'Republic of Congo',
	'CRI' : 'Costa Rica',
	'CIV' : 'Côte d\'Ivoire',
	'HRV' : 'Croatia',
	'CYP' : 'Cyprus',
	'CYT' : 'Cyprus, North',	# invented code, not ISO 3166-1
	'CZE' : 'Czech Republic',
	'DNK' : 'Denmark',
	'DJI' : 'Djibouti',
	'DMA' : 'Dominica',
	'DOM' : 'Dominican Republic',
	'ECU' : 'Ecuador',
	'EGY' : 'Egypt',
	'SLV' : 'El Salvador',
	'GNQ' : 'Equatorial Guinea',
	'ERI' : 'Eritrea',
	'EST' : 'Estonia',
	'ETH' : 'Ethiopia',
	'FJI' : 'Fiji',
	'FIN' : 'Finland',
	'FRA' : 'France',
	'GAB' : 'Gabon',
	'GMB' : 'The Gambia',
	'GEO' : 'Georgia',
	'DEU' : 'Germany',
	'GHA' : 'Ghana',
	'GRC' : 'Greece',
	'GRD' : 'Grenada',
	'GTM' : 'Guatemala',
	'GIN' : 'Guinea',
	'GNB' : 'Guinea-Bissau',
	'GUY' : 'Guyana',
	'HTI' : 'Haiti',
	'HND' : 'Honduras',
	'HKG' : 'Hong Kong',
	'HUN' : 'Hungary',
	'ISL' : 'Iceland',
	'IND' : 'India',
	'IDN' : 'Indonesia',
	'IRN' : 'Islamic Republic of Iran',
	'IRQ' : 'Iraq',
	'IRL' : 'Ireland',
	'ISR' : 'Israel',
	'ITA' : 'Italy',
	'JAM' : 'Jamaica',
	'JPN' : 'Japan',
	'JOR' : 'Jordan',
	'KAZ' : 'Kazakhstan',
	'KEN' : 'Kenya',
	'KIR' : 'Kiribati',
	'KOR' : 'Korea, South',
	'PRK' : 'Korea, North',
	'UVK' : 'Kosovo',
	'KWT' : 'Kuwait',
	'KGZ' : 'Kyrgyz Republic',
	'LAO' : 'Lao P.D.R.',
	'LVA' : 'Latvia',
	'LBN' : 'Lebanon',
	'LSO' : 'Lesotho',
	'LBR' : 'Liberia',
	'LBY' : 'Libya',
	'LTU' : 'Lithuania',
	'LUX' : 'Luxembourg',
	'MAC' : 'Macau',
	'MKD' : 'FYR Macedonia',
	'MDG' : 'Madagascar',
	'MWI' : 'Malawi',
	'MYS' : 'Malaysia',
	'MDV' : 'Maldives',
	'MLI' : 'Mali',
	'MLT' : 'Malta',
	'MHL' : 'Marshall Islands',
	'MRT' : 'Mauritania',
	'MUS' : 'Mauritius',
	'MEX' : 'Mexico',
	'FSM' : 'Micronesia',
	'MDA' : 'Moldova',
	'MNG' : 'Mongolia',
	'MNE' : 'Montenegro',
	'MAR' : 'Morocco',
	'MOZ' : 'Mozambique',
	'MMR' : 'Myanmar',
	'NAM' : 'Namibia',
	'NPL' : 'Nepal',
	'NLD' : 'Netherlands',
	'NZL' : 'New Zealand',
	'NIC' : 'Nicaragua',
	'NER' : 'Niger',
	'NGA' : 'Nigeria',
	'NOR' : 'Norway',
	'OMN' : 'Oman',
	'PAK' : 'Pakistan',
	'PLW' : 'Palau',
	'PAN' : 'Panama',
	'PNG' : 'Papua New Guinea',
	'PRY' : 'Paraguay',
	'PER' : 'Peru',
	'PHL' : 'Philippines',
	'POL' : 'Poland',
	'PRT' : 'Portugal',
	'PRI' : 'Puerto Rico',
	'QAT' : 'Qatar',
	'ROU' : 'Romania',
	'RUS' : 'Russia',
	'RWA' : 'Rwanda',
	'WSM' : 'Samoa',
	'SMR' : 'San Marino',
	'STP' : 'São Tomé and Príncipe',
	'SAU' : 'Saudi Arabia',
	'SEN' : 'Senegal',
	'SRB' : 'Serbia',
	'SYC' : 'Seychelles',
	'SLE' : 'Sierra Leone',
	'SGP' : 'Singapore',
	'SVK' : 'Slovak Republic',
	'SVN' : 'Slovenia',
	'SLB' : 'Solomon Islands',
	'ZAF' : 'South Africa',
	'SSD' : 'South Sudan',
	'ESP' : 'Spain',
	'LKA' : 'Sri Lanka',
	'KNA' : 'St. Kitts and Nevis',
	'LCA' : 'St. Lucia',
	'VCT' : 'St. Vincent and the Grenadines',
	'SDN' : 'Sudan',
	'SUR' : 'Suriname',
	'SWZ' : 'Swaziland',
	'SWE' : 'Sweden',
	'CHE' : 'Switzerland',
	'SYR' : 'Syria',
	'TWN' : 'Taiwan Province of China',
	'TJK' : 'Tajikistan',
	'TZA' : 'Tanzania',
	'THA' : 'Thailand',
	'TLS' : 'Timor-Leste',
	'TGO' : 'Togo',
	'TON' : 'Tonga',
	'TTO' : 'Trinidad and Tobago',
	'TUN' : 'Tunisia',
	'TUR' : 'Turkey',
	'TKM' : 'Turkmenistan',
	'TUV' : 'Tuvalu',
	'UGA' : 'Uganda',
	'UKR' : 'Ukraine',
	'ARE' : 'United Arab Emirates',
	'GBR' : 'United Kingdom',
	'USA' : 'United States',
	'URY' : 'Uruguay',
	'UZB' : 'Uzbekistan',
	'VUT' : 'Vanuatu',
	'VEN' : 'Venezuela',
	'VNM' : 'Vietnam',
	'ESH' : 'Western Sahara',
	'YEM' : 'Yemen',
	'ZMB' : 'Zambia',
	'ZWE' : 'Zimbabwe'
}
# http://en.wikipedia.org/wiki/List_of_countries_by_GDP_(nominal)
# (from World Bank 2012 column)
# http://en.wikipedia.org/wiki/List_of_countries_by_GDP_(PPP)
# (GDP numbers are taken from the 2012 IMF column with missing numbers copied from the CIA column.)
# http://en.wikipedia.org/wiki/List_of_countries_by_population
# http://wdi.worldbank.org/table/2.9 (Percentage share of income in 20% brackets)
# http://en.wikipedia.org/wiki/List_of_countries_by_English-speaking_population

# http://en.wikipedia.org/wiki/List_of_languages_by_number_of_native_speakers gives
# Mandarin 955m, Wu 80m, Yue 59m, etc.  Since the PRC, Taiwan, and Singapore have all
# standardized on Mandarin, however, I assign all Chinese to the Beijing dialect.
# In India, the central government cannot dictate Hindi as standard, so I include the 
# top six languages.


langinfo = {
        'USA' : { "EN" : 0.9, "ES" : 0.1 },
        'CHN' : { "ZH" : 1.0 },
        'IND' : { "EN" : 125.0/1210.6,
		  "HI" : 603.0/1210.6,	# Hindi + Urdu
		  "BN" : 83.0/1210.6,
		  "TE" : 74.0/1210.6,
		  "MR" : 72.0/1210.6,
		  "TA" : 61.0/1210.6,
		  "colonial" : True
		 },
                # http://articles.timesofindia.indiatimes.com/2010-03-14/india/28117934_1_second-language-speakers-urdu, 125m EN, 551m HI
        'JPN' : { "JA" : 1.0 },
        'DEU' : { "DE" : 1.0 },
        'RUS' : { "RU" : 1.0 },
        'BRA' : { "PT" : 1.0 },
        'GBR' : { "EN" : 1.0 },
        'FRA' : { "FR" : 1.0 },
        'ITA' : { "IT" : 1.0 },
	'SMR' : { "IT" : 1.0 },
        'MEX' : { "ES" : 1.0 },
        'KOR' : { "KO" : 1.0 },
        'CAN' : { "EN" : 0.7, "FR" : 0.3 },
        'ESP' : { "ES" : 1.0 },
        'IDN' : { "MY" : 1.0, "JV" : 82.0/237.6 },
        'TUR' : { "TR" : 1.0 },
        'IRN' : { "FA" : 0.75, "TR" : 0.15 },
		# I don't know what to make of the widely varying estimates in http://en.wikipedia.org/wiki/Languages_of_Iran
		# but I label Azerbaijani as Turkish and give it a percentage somewhere in the range.
        'AUS' : { "EN" : 1.0 },
        'TWN' : { "ZH" : 1.0 },
        'POL' : { "PO" : 1.0 },
        'ARG' : { "ES" : 1.0 },
        'SAU' : { "AR" : 1.0 },
        'NLD' : { "NL" : 1.0 },
        'THA' : { "TH" : 1.0 },
        'ZAF' : { "EN" : 1.0, "NL" : 15.0/53.0 },	# NL = Afrikaans
        'EGY' : { "AR" : 1.0 },
        'PAK' : { "HI" : 1.0, # HI = Urdu
		  "EN" : 0.49,
		  "colonial" : True },
        'COL' : { "ES" : 1.0 },
        'MYS' : { "MY" : 1.0, "EN" : 0.21, "TA" : 0.07, "colonial" : True },
        'NGA' : { "EN" : 0.53, "colonial" : True },
        'BEL' : { "NL" : 0.6, "FR" : 0.4 },
        'PHL' : { "EN" : 0.79, "TG" : 1.0, "colonial" : True },
        'VEN' : { "ES" : 1.0 },
        'SWE' : { "Ng" : 1.0, "SV" : 1.0 },
        'HKG' : { "ZH" : 1.0, "EN" : 0.46, "colonial" : True },
        'CHE' : { "DE" : 0.64, "FR" : 0.2, "IT" : 0.065 },
        'AUT' : { "DE" : 1.0 },
        'UKR' : { "RU" : 1.0 },
        'SGP' : { "ZH" : 1.0, "EN" : 0.8, "MY" : 0.12, "TA" : 0.03, "colonial" : True },
        'PER' : { "ES" : 1.0 },
        'VNM' : { "VI" : 1.0 },
        'CHL' : { "ES" : 1.0 },
        'BGD' : { "EN" : 0.18, "BN" : 1.0, "colonial" : True },
        'CZE' : { "CS" : 1.0 },
        'GRC' : { "GR" : 1.0 },
        'NOR' : { "Ng" : 1.0, "NO" : 1.0 },
        'DZA' : { "AR" : 1.0, "FR" : 0.3, "colonial" : True },
        'ROU' : { "RO" : 1.0 },
        'ARE' : { "AR" : 1.0 },
        'ISR' : { "HE" : 1.0, "EN" : 0.85, "AR": 0.207, "RU": 0.20 },
        'PRT' : { "PT" : 1.0 },
        'KAZ' : { "KZ" : 1.0, "RU" : 1.0 },
        'DNK' : { "Ng" : 1.0, "DA" : 1.0 },
        'FIN' : { "FI" : 1.0 },
        'HUN' : { "HU" : 1.0 },
        'IRL' : { "EN" : 1.0 },
        'QAT' : { "AR" : 1.0 },
        'MAR' : { "AR" : 1.0, "FR" : 0.3, "colonial" : True },
        'KWT' : { "AR" : 1.0 },
        'IRQ' : { "AR" : 1.0 },
        'BLR' : { "RU" : 1.0 },
        'ECU' : { "ES" : 1.0 },
        'SVK' : { "SK" : 1.0 },
        'NZL' : { "EN" : 1.0 },
        'AGO' : { "PT" : 1.0 },
        'LKA' : { "EN" : 0.1, "TA" : 0.11, "colonial" : True },
        'CUB' : { "ES" : 1.0 },
        'TUN' : { "AR" : 1.0, "FR" : 0.3, "colonial" : True },
        'UZB' : { "FA" : 0.25,	# Tajik
		  "RU" : 0.4,	# in 2003 over 50%?
		  "colonial" : True },
        'BGR' : { "BG" : 1.0 },
        'ETH' : { "EN" : 0.22, "colonial" : True },
        'DOM' : { "ES" : 1.0 },
        'AZE' : { "TR" : 1.0 },
		# Azerbaijani is mutually intelligible with Turkish
        'OMN' : { "AR" : 1.0 },
        'MMR' : { "EN" : 0.05, "colonial" : True },
                # http://en.wikipedia.org/wiki/Burmese_English
        'LBY' : { "AR" : 1.0 },
        'GHA' : { "EN" : 0.2, "colonial" : True },
        'SDN' : { "AR" : 1.0 },
        'HRV' : { "SR" : 1.0 },
        'SRB' : { "SR" : 1.0 },
        'GTM' : { "ES" : 1.0 },
        'KEN' : { "EN" : 0.19, "colonial" : True, "SW" : 1.0 },
        'TZA' : { "EN" : 0.1, "colonial" : True, "SW" : 1.0 },
        'PRI' : { "ES" : 1.0 },
        'LTU' : { "RU" : 0.3 },
        'LBN' : { "AR" : 1.0, "FR" : 0.3, "colonial" : True },
        'CRI' : { "ES" : 1.0 },
        'SVN' : { "SL" : 1.0 },
        'YEM' : { "AR" : 1.0 },
        'PAN' : { "ES" : 1.0 },
        'BOL' : { "ES" : 1.0 },
        'URY' : { "ES" : 1.0 },
        'UGA' : { "EN" : 0.08, "colonial" : True, "SW" : 1.0 },
        'CMR' : { "FR" : 0.8, "EN" : 0.2, "colonial" : True },
        'TKM' : { "RU" : 0.1, "colonial" : True },
        'MAC' : { "ZH" : 1.0 },
        'SLV' : { "ES" : 1.0 },
        'LUX' : { "DE" : 1.0 },
        'PRY' : { "ES" : 1.0 },
        'NPL' : { "EN" : 0.03, "colonial" : True },
        'PRK' : { "KO" : 1.0 },
        'COT' : { "FR" : 1.0 },
        'JOR' : { "AR" : 1.0 },
        'HND' : { "ES" : 1.0 },
        'LVA' : { "RU" : 0.2 },
        'KHM' : { "FR" : 0.1, "EN" : 0.1, "colonial" : True },
        'BHR' : { "AR" : 1.0 },
        'BIH' : { "SR" : 1.0 },
        'AFG' : { "PA" : 0.5, "FA" : 0.75 },
        'BWA' : { "EN" : 0.38, "colonial" : True },
        'EST' : { "RU" : 0.1 },
        'GNQ' : { "ES" : 1.0 },
	'COD' : { "FR" : 1.0, "SW" : 0.35 },
        'TTO' : { "EN" : 0.88 },
        'GAB' : { "FR" : 1.0 },
        'GEO' : { "X" : 1.0 },
        'SEN' : { "FR" : 1.0 },
        'MOZ' : { "PT" : 0.5, "colonial" : True },
                # http://en.wikipedia.org/wiki/Languages_of_Mozambique
        'ALB' : { "X" : 1.0 },
        'JAM' : { "EN" : 1.0 },
        'BFA' : { "FR" : 1.0 },
        'ZMB' : { "EN" : 0.16, "colonial" : True },
        'CYP' : { "EN" : 0.73, "GR" : 1.0 },
	'CYT' : { "TR" : 1.0 },
	'MKD' : { "BG" : 0.67, "TR" : 0.035 },	# Macedonian is mutually intelligible with Bulgarian.
        'BRN' : { "MY" : 1.0 },
        'MDG' : { "FR" : 1.0 },
        'TCD' : { "FR" : 1.0 },
        'MUS' : { "EN" : 0.16, "FR" : 0.5, "colonial" : True },
        'NIC' : { "ES" : 1.0 },
	'COG' : { "FR" : 1.0 },
        'LAO' : { "FR" : 0.3, "colonial" : True },
        'ARM' : { "RU" : 0.5, "colonial" : True },
        'PNG' : { "EN" : 0.5, "colonial" : True },
        'TJK' : { "FA" : 1.0,	# Tajik
		  "RU" : 0.1, "colonial" : True },
        'MLI' : { "FR" : 1.0 },
        'NAM' : { "EN" : 0.17, "colonial" : True, "NL" : 0.11, "PT" : 0.04 },	# NL = Afrikaans
		# http://en.wikipedia.org/wiki/Languages_of_Namibia
        'BEN' : { "FR" : 1.0 },
        'MNG' : { "X" : 1.0 },
        'RWA' : { "EN" : 0.15, "FR" : 0.4, "colonial" : True },
        'MWI' : { "EN" : 0.04, "colonial" : True },
	'UVK' : { "SR" : 1.0 },
        'NER' : { "FR" : 1.0 },
        'KGZ' : { "RU" : 0.3, "colonial" : True },
        'HTI' : { "FR" : 1.0 },
        'ISL' : { "Ng" : 1.0, "IS" : 1.0 },
        'MDA' : { "RU" : 0.1 },
        'GIN' : { "FR" : 1.0 },
        'MLT' : { "EN" : 0.89 },
        'BHS' : { "EN" : 0.87 },
        'TLS' : { "PT" : 1.0 },
        'SSD' : { "EN" : 1.0 },
        'SLE' : { "EN" : 0.84, "colonial" : True },
        'MRT' : { "AR" : 1.0, "FR" : 1.0 },
        'MNE' : { "X" : 1.0 },
        'BRB' : { "EN" : 1.0 },
        'ZWE' : { "EN" : 0.42, "colonial" : True },
        'TGO' : { "FR" : 1.0 },
        'SUR' : { "NL" : 1.0, "EN" : 0.87 },
        'GUY' : { "EN" : 0.91 },
        'SWZ' : { "EN" : 0.04, "colonial" : True },
        'SOM' : { "AR" : 0.1, "EN" : 0.1, "colonial" : True },
        'BDI' : { "FR" : 1.0 },
        'BTN' : { "EN" : 0.11, "colonial" : True },
        'ERI' : { "EN" : 0.10, "colonial" : True },
        'FJI' : { "EN" : 0.21, "colonial" : True },
        'LSO' : { "EN" : 0.28, "colonial" : True },
        'CAF' : { "FR" : 1.0 },
        'GMB' : { "EN" : 0.02, "colonial" : True },
        'BLZ' : { "EN" : 0.82 },
        'MDV' : { "EN" : 0.1, "colonial" : True },
        'LBR' : { "EN" : 0.83, "colonial" : True },
        'SYC' : { "FR" : 1.0 },
        'DJI' : { "AR" : 1.0, "FR" : 1.0 },
        'LCA' : { "EN" : 0.6, "FR" : 0.4 },
        'CPV' : { "PT" : 1.0 },
        'SLB' : { "EN" : 0.32 },
        'GNB' : { "PT" : 0.11, "FR" : 0.05, "colonial" : True },
                # http://en.wikipedia.org/wiki/Languages_of_Guinea-Bissau
        'ATG' : { "EN" : 0.8 },
        'GRD' : { "EN" : 0.91 },
        'VCT' : { "EN" : 0.95 },
        'VUT' : { "EN" : 0.84, "FR" : 0.5 },
        'WSM' : { "EN" : 0.5 },
        'DMA' : { "EN" : 0.94 },
        'ESH' : { "AR" : 1.0 },
        'KNA' : { "EN" : 0.78 },
        'COM' : { "AR" : 0.5, "FR" : 0.5 },
        'TON' : { "EN" : 0.3 },
        'KIR' : { "EN" : 0.24 },
        'STP' : { "PT" : 1.0 },
        'FSM' : { "EN" : 0.58 },
        'SYR' : { "AR" : 1.0 }
}
brackets = {
	# Updated from http://wdi.worldbank.org/table/2.9# on 2015-04-02
	#						 gi  top top 4th 3rd 2nd low low
	# country				    year  ni 10% 20% 20% 20% 20% 20% 10%
	
        'AFG' : [ 2008, 28, 23, 37, 22, 17, 14, 9, 4 ], 
	'ALB' : [ 2012, 29, 23, 38, 23, 17, 13, 9, 4 ],
        'DZA' : [ 1995, 35, 27, 43, 23, 16, 12, 7, 3 ], 
        'AGO' : [ 2009, 43, 32, 49, 22, 15, 10, 5, 2 ], 
	'ARG' : [ 2011, 44, 32, 49, 22, 15, 10, 5, 2 ],
	'ARM' : [ 2012, 30, 25, 39, 22, 17, 13, 9, 4 ],
	'AUS' : [ 2003, 34, 25, 41, 23, 17, 12, 7, 2 ],
	'AUT' : [ 2004, 30, 24, 39, 22, 17, 13, 8, 3 ],
	'AZE' : [ 2008, 33, 27, 41, 22, 16, 12, 8, 3 ],
        'BGD' : [ 2010, 32, 27, 41, 21, 16, 12, 9, 4 ], 
        'BLR' : [ 2011, 26, 21, 36, 23, 18, 14, 9, 4 ], 
	'BEL' : [ 2000, 33, 28, 42, 21, 16, 13, 8, 3 ],
	'BLZ' : [ 1999, 53, 42, 58, 19, 12, 8, 3, 1 ],
	'BEN' : [ 2012, 44, 35, 50, 20, 14, 9, 6, 3 ],
	'BTN' : [ 2012, 39, 31, 46, 21, 15, 11, 7, 3 ],
	'BOL' : [ 2012, 47, 34, 50, 23, 15, 9, 3, 1 ],
	'BIH' : [ 2007, 33, 25, 41, 23, 17, 12, 7, 3 ],
	'BWA' : [ 2009, 60, 50, 65, 17, 10, 6, 3, 1 ],
	'BRA' : [ 2012, 53, 42, 57, 19, 12, 8, 3, 1 ],
	'BGR' : [ 2011, 34, 26, 41, 23, 17, 13, 6, 2 ],
        'BFA' : [ 2009, 40, 32, 47, 21, 15, 11, 7, 3 ], 
        'BDI' : [ 2006, 33, 28, 43, 21, 15, 12, 9, 4 ], 
	'KHM' : [ 2011, 32, 27, 41, 21, 16, 12, 9, 4 ],
	'CMR' : [ 2007, 41, 32, 48, 21, 15, 10, 6, 3 ],
	'CAN' : [ 2010, 34, 26, 41, 23, 17, 12, 7, 3 ],
	'CPV' : [ 2008, 44, 35, 50, 21, 14, 9, 6, 2 ],
	'CAF' : [ 2008, 56, 46, 61, 18, 11, 7, 3, 1 ],
	'TCD' : [ 2011, 43, 33, 49, 22, 15, 10, 5, 2 ],
	'CHL' : [ 2011, 51, 42, 57, 18, 12, 8, 5, 2 ],
	'CHN' : [ 2011, 37, 30, 47, 23, 15, 10, 5, 2 ],
	'COL' : [ 2012, 54, 42, 58, 20, 12, 7, 3, 1 ],
	'COM' : [ 2004, 64, 55, 68, 15, 9, 5, 3, 1 ],
	'COD' : [ 2006, 44, 35, 51, 21, 14, 9, 5, 2 ], 
	'COG' : [ 2011, 40, 30, 46, 23, 15, 10, 6, 2 ],
	'CRI' : [ 2012, 49, 37, 54, 21, 13, 8, 4, 1 ],
	'CIV' : [ 2008, 43, 33, 49, 22, 15, 10, 5, 2 ],
	'HRV' : [ 2008, 34, 28, 42, 21, 16, 12, 8, 3 ],
	'CZE' : [ 2011, 26, 22, 36, 22, 18, 15, 9, 4 ],
	'DNK' : [ 2010, 27, 22, 36, 22, 18, 14, 9, 3 ],
	'DJI' : [ 2002, 40, 31, 46, 22, 15, 11, 6, 2 ],
	'DOM' : [ 2012, 46, 36, 52, 21, 14, 9, 5, 2 ],
	'ECU' : [ 2012, 47, 35, 52, 21, 14, 9, 4, 1 ],
	'EGY' : [ 2008, 31, 27, 40, 21, 16, 13, 9, 4 ],
	'SLV' : [ 2012, 42, 32, 48, 21, 15, 10, 6, 2 ],
	'EST' : [ 2011, 33, 25, 40, 23, 17, 13, 7, 2 ],
	'ETH' : [ 2011, 34, 28, 42, 22, 16, 12, 8, 3 ],
        'FJI' : [ 2009, 43, 35, 50, 20, 14, 10, 6, 3 ], 
	'FIN' : [ 2010, 28, 23, 37, 23, 17, 14, 9, 4 ],
	'FRA' : [ 2005, 32, 25, 40, 23, 17, 13, 8, 3 ],
	'GAB' : [ 2005, 42, 33, 49, 21, 14, 10, 6, 2 ],
        'GMB' : [ 2003, 47, 37, 53, 21, 13, 9, 5, 2 ], 
	'GEO' : [ 2012, 41, 31, 47, 22, 15, 10, 5, 2 ],
	'DEU' : [ 2010, 31, 24, 39, 22, 17, 13, 8, 3 ],
        'GHA' : [ 2006, 43, 33, 49, 22, 15, 10, 5, 2 ], 
	'GRC' : [ 2010, 35, 26, 41, 23, 17, 12, 6, 2 ],
	'GTM' : [ 2011, 52, 42, 57, 19, 12, 8, 4, 1 ],
	'GIN' : [ 2012, 34, 26, 42, 22, 17, 12, 8, 3 ],
	'GNB' : [ 2002, 36, 28, 43, 22, 16, 12, 7, 3 ],
	'GUY' : [ 1998, 45, 34, 50, 22, 15, 10, 4, 1 ],
        'HTI' : [ 2001, 59, 48, 63, 18, 10, 6, 2, 1 ], 
	'HND' : [ 2011, 57, 46, 61, 19, 11, 7, 3, 1 ],
        'HKG' : [ 1996, 43, 35, 51, 21, 14, 9, 5, 2 ], 
	'HUN' : [ 2011, 29, 23, 37, 23, 18, 14, 8, 3 ],
	'ISL' : [ 2010, 26, 22, 36, 22, 18, 14, 10, 4 ],
	'IND' : [ 2012, 34, 29, 43, 21, 16, 12, 9, 4 ],
	'IDN' : [ 2011, 38, 28, 44, 22, 16, 11, 8, 3 ],
        'IRN' : [ 2005, 38, 30, 45, 22, 16, 11, 6, 3 ], 
	'IRQ' : [ 2012, 30, 24, 39, 23, 17, 13, 9, 4 ],
	'IRL' : [ 2010, 32, 25, 40, 23, 17, 13, 8, 3 ],
	'ISR' : [ 2010, 43, 31, 47, 23, 15, 10, 5, 2 ],
	'ITA' : [ 2010, 36, 26, 42, 23, 17, 12, 6, 2 ],
	'JAM' : [ 2004, 46, 36, 52, 21, 13, 9, 5, 2 ],
	'JPN' : [ 2008, 32, 25, 40, 23, 17, 13, 7, 3 ],
	'JOR' : [ 2010, 34, 28, 42, 22, 16, 12, 8, 4 ],
	'KAZ' : [ 2010, 29, 24, 38, 22, 17, 13, 9, 4 ],
	'KEN' : [ 2005, 48, 38, 53, 20, 13, 9, 5, 2 ],
        'KOR' : [ 1998, 32, 22, 37, 23, 18, 14, 8, 3 ], 
        'UVK' : [ 2010, 30, 23, 38, 23, 17, 13, 8, 3 ], 	# copied from Serbia
        'KGZ' : [ 2011, 33, 26, 41, 22, 17, 12, 8, 3 ], 
        'LAO' : [ 2012, 36, 30, 44, 21, 15, 11, 8, 3 ],
	'LVA' : [ 2011, 36, 27, 43, 22, 16, 12, 6, 2 ],
        'LBN' : [ 2010, 43, 31, 47, 23, 15, 10, 5, 2 ],		# copied from Israel
	'LSO' : [ 2010, 54, 41, 58, 20, 12, 7, 3, 1 ],
	'LBR' : [ 2007, 38, 30, 45, 22, 16, 11, 6, 2 ],
        'LBY' : [ 2010, 36, 28, 43, 23, 16, 12, 7, 3 ],		# copied from Tunisia
	'LTU' : [ 2011, 33, 25, 40, 23, 17, 13, 7, 3 ],
        'LUX' : [ 2000, 31, 24, 39, 23, 17, 13, 8, 4 ], 
        'MKD' : [ 2010, 44, 32, 49, 22, 14, 9, 5, 2 ], 
	'MDG' : [ 2010, 41, 33, 48, 20, 15, 11, 7, 3 ],
	'MWI' : [ 2010, 46, 37, 52, 20, 13, 9, 5, 2 ],
        'MYS' : [ 2009, 46, 35, 51, 22, 14, 9, 5, 2 ], 
        'MDV' : [ 2004, 37, 28, 44, 23, 16, 11, 7, 3 ], 
        'MLI' : [ 2010, 33, 26, 41, 22, 16, 12, 8, 3 ], 
	'MRT' : [ 2008, 40, 32, 47, 22, 15, 10, 6, 2 ],
	'MUS' : [ 2012, 36, 29, 44, 22, 16, 12, 7, 3 ],
	'MEX' : [ 2012, 48, 39, 54, 19, 13, 9, 5, 2 ],
        'FSM' : [ 2000, 61, 47, 64, 19, 10, 5, 2, 0 ], 
	'MDA' : [ 2011, 31, 25, 39, 22, 17, 13, 8, 4 ],
        'MNG' : [ 2008, 37, 28, 44, 22, 16, 11, 7, 3 ], 
	'MNE' : [ 2011, 31, 25, 39, 22, 17, 13, 8, 3 ],
	'MAR' : [ 2007, 41, 33, 48, 21, 15, 10, 7, 3 ],
	'MOZ' : [ 2009, 46, 37, 51, 20, 14, 9, 5, 2 ],
	'NAM' : [ 2010, 61, 52, 66, 16, 9, 6, 3, 1 ],
        'NPL' : [ 2010, 33, 27, 41, 22, 16, 12, 8, 4 ], 
	'NLD' : [ 2010, 29, 23, 37, 23, 18, 14, 8, 3 ],
        'NZL' : [ 1997, 36, 28, 44, 23, 16, 11, 6, 2 ], 
	'NIC' : [ 2009, 46, 35, 51, 21, 14, 9, 5, 2 ],
	'NER' : [ 2011, 31, 26, 40, 21, 16, 13, 9, 4 ],
        'NGA' : [ 2011, 40, 30, 46, 22, 15, 10, 6, 2 ], 
	'NOR' : [ 2010, 27, 22, 36, 23, 18, 14, 9, 3 ],
	'PAK' : [ 2011, 30, 26, 39, 21, 17, 13, 10, 4 ],
	'PAN' : [ 2012, 52, 40, 56, 20, 13, 8, 3, 1 ],
        'PNG' : [ 1996, 51, 41, 56, 19, 12, 8, 5, 2 ], 
	'PRY' : [ 2012, 48, 37, 53, 21, 14, 9, 4, 1 ],
	'PER' : [ 2012, 45, 34, 50, 22, 15, 9, 4, 1 ],
	'PHL' : [ 2012, 43, 33, 50, 21, 14, 9, 6, 3 ],
	'POL' : [ 2011, 33, 26, 41, 22, 17, 12, 8, 3 ],
        'PRT' : [ 1997, 38, 30, 46, 22, 15, 11, 6, 2 ], 
        'QAT' : [ 2007, 41, 36, 52, 0, 0, 0, 4, 1 ], 
	'ROU' : [ 2012, 27, 21, 36, 23, 18, 14, 9, 4 ],
        'RUS' : [ 2009, 40, 32, 47, 21, 15, 10, 6, 3 ], 
	'RWA' : [ 2011, 51, 43, 57, 18, 12, 8, 5, 2 ],
        'STP' : [ 2010, 34, 26, 42, 23, 16, 12, 7, 3 ],
        'SEN' : [ 2011, 40, 31, 47, 22, 15, 10, 6, 2 ], 
        'SRB' : [ 2010, 30, 23, 38, 23, 17, 13, 8, 3 ], 
        'SYC' : [ 2007, 66, 60, 70, 13, 8, 6, 4, 2 ], 
        'SLE' : [ 2011, 35, 29, 44, 21, 16, 12, 8, 3 ], 
        'SGP' : [ 1998, 42, 33, 49, 22, 15, 9, 5, 2 ], 
	'SVK' : [ 2011, 27, 21, 35, 23, 18, 14, 9, 3 ],
	'SVN' : [ 2011, 25, 21, 35, 23, 18, 15, 10, 4 ],
	'ZAF' : [ 2011, 65, 54, 70, 16, 8, 4, 2, 1 ],
        'SSD' : [ 2009, 46, 35, 51, 22, 14, 9, 5, 2 ],        # copied from Malaysia (GINI=46)
	'ESP' : [ 2010, 36, 25, 41, 24, 17, 12, 5, 1 ],
	'LKA' : [ 2010, 36, 30, 45, 21, 15, 11, 8, 3 ],
        'LCA' : [ 1995, 43, 32, 48, 22, 15, 10, 5, 2 ], 
        'SDN' : [ 2009, 35, 27, 42, 23, 16, 12, 7, 3 ], 
        'SUR' : [ 1999, 53, 41, 57, 20, 12, 7, 3, 1 ], 
        'SWZ' : [ 2010, 51, 40, 57, 20, 12, 7, 4, 2 ], 
	'SWE' : [ 2005, 26, 21, 36, 23, 18, 14, 10, 4 ],
	'CHE' : [ 2004, 32, 24, 40, 23, 17, 12, 8, 3 ],
        'SYR' : [ 2004, 36, 29, 44, 21, 16, 11, 8, 3 ], 
        'TJK' : [ 2009, 31, 24, 39, 23, 17, 13, 8, 4 ], 
	'TZA' : [ 2012, 38, 31, 46, 21, 15, 11, 7, 3 ],
        'THA' : [ 2010, 39, 31, 47, 21, 15, 11, 7, 3 ], 
        'TGO' : [ 2011, 39, 29, 46, 22, 15, 10, 6, 2 ], 
        'TUN' : [ 2010, 36, 28, 43, 23, 16, 12, 7, 3 ], 
	'TUR' : [ 2011, 40, 31, 46, 22, 15, 11, 6, 2 ],
	'TKM' : [ 1998, 41, 32, 47, 22, 15, 10, 6, 3 ],
	'UGA' : [ 2009, 44, 36, 51, 20, 14, 10, 6, 2 ],
	'UKR' : [ 2010, 25, 21, 35, 22, 18, 14, 10, 4 ],
	'GBR' : [ 2010, 38, 29, 44, 23, 16, 11, 6, 2 ],
	'USA' : [ 2010, 41, 30, 46, 23, 16, 10, 5, 1 ],
	'URY' : [ 2012, 41, 30, 47, 23, 15, 10, 5, 2 ],
	'UZB' : [ 2003, 35, 28, 43, 21, 16, 12, 7, 3 ],
	'VEN' : [ 2006, 45, 33, 50, 22, 15, 10, 4, 1 ],
	'VNM' : [ 2012, 36, 28, 43, 22, 16, 12, 7, 3 ],
	'YEM' : [ 2005, 36, 30, 44, 21, 15, 12, 8, 3 ],
	'ZMB' : [ 2010, 57, 47, 62, 18, 10, 6, 4, 1 ],
        'ZWE' : [ 1995, 50, 40, 56, 19, 12, 8, 5, 2 ], 

        'CUB' : [ 2010, 47, 36, 53, 21, 13, 9, 5, 2 ],        # copied from Dominican Republic
        'GNQ' : [ 2010, 47, 36, 53, 21, 13, 9, 5, 2 ],        # copied from Dominican Republic
        'PRI' : [ 2010, 47, 36, 53, 21, 13, 9, 5, 2 ],        # copied from Dominican Republic
	'TLS' : [ 2007, 30, 25, 40, 22, 17, 13, 9, 4 ],
}

# Links to IMF World Economic Outlook = https://www.imf.org/external/pubs/ft/weo/data/changes.htm
# 'pop' = LP, 'gdp' = NGDPD, 'ppp' = PPPGDP
# 
# Archive of World Economic Outlook databases = https://www.imf.org/external/ns/cs.aspx?id=28

IMFEst2020 = {
	'AFG' : { 'pop' :   35.667,	'ppp' :    91.07 },
	'ALB' : { 'pop' :    2.691,	'ppp' :    44.77 },
	'DZA' : { 'pop' :   43.03,	'ppp' :   757.768 },
	'AGO' : { 'pop' :   29.115,	'ppp' :   262.065 },
	'ATG' : { 'pop' :    0.094,	'ppp' :     2.569 },
	'ARG' : { 'pop' :   44.886,	'ppp' :  1065.527 },
	'ARM' : { 'pop' :    3.3,	'ppp' :    29.61 },
	'AUS' : { 'pop' :   25.391,	'ppp' :  1449.532 },
	'AUT' : { 'pop' :    8.732,	'ppp' :   472.139 },
	'AZE' : { 'pop' :    9.843,	'ppp' :   215.091 },
	'BHS' : { 'pop' :    0.385,	'ppp' :    11.242 },
	'BHR' : { 'pop' :    1.349,	'ppp' :    80.589 },
	'BGD' : { 'pop' :  168.312,	'ppp' :   879.473 },
	'BRB' : { 'pop' :    0.283,	'ppp' :     5.509 },
	'BLR' : { 'pop' :    9.187,	'ppp' :   187.304 },
	'BEL' : { 'pop' :   11.593,	'ppp' :   584.337 },
	'BLZ' : { 'pop' :    0.402,	'ppp' :     3.799 },
	'BEN' : { 'pop' :   12.19,	'ppp' :    30.47 },
	'BTN' : { 'pop' :    0.845,	'ppp' :    10.575 },
	'BOL' : { 'pop' :   12.714,	'ppp' :    98.86 },
	'BIH' : { 'pop' :    3.825,	'ppp' :    51.797 },
	'BWA' : { 'pop' :    2.258,	'ppp' :    47.208 },
	'BRA' : { 'pop' :  212.078,	'ppp' :  3977.896 },
	'BRN' : { 'pop' :    0.454,	'ppp' :    44.08 },
	'BGR' : { 'pop' :    6.989,	'ppp' :   159.734 },
	'BFA' : { 'pop' :   20.69,	'ppp' :    46.517 },
	'BDI' : { 'pop' :   10.608,	'ppp' :    12.61 },
	'CPV' : { 'pop' :    0.558,	'ppp' :     4.561 },
	'KHM' : { 'pop' :   16.744,	'ppp' :    84.525 },
	'CMR' : { 'pop' :   26.144,	'ppp' :    99.914 },
	'CAN' : { 'pop' :   37.52,	'ppp' :  1985.811 },
	'CAF' : { 'pop' :    5.282,	'ppp' :     4.43 },
	'TCD' : { 'pop' :   13.122,	'ppp' :    45.515 },
	'CHL' : { 'pop' :   18.973,	'ppp' :   558.953 },
	'CHN' : { 'pop' : 1411.205,	'ppp' : 28229.144 },
	'COL' : { 'pop' :   51.041,	'ppp' :   898.374 },
	'COM' : { 'pop' :    0.927,	'ppp' :     1.678 },
	'COD' : { 'pop' :   94.689,	'ppp' :    95.312 },
	'COG' : { 'pop' :    4.848,	'ppp' :    41.606 },
	'CRI' : { 'pop' :    5.161,	'ppp' :   101.35 },
	'CIV' : { 'pop' :   26.499,	'ppp' :   118.88 },
	'HRV' : { 'pop' :    4.236,	'ppp' :   107.599 },
	'CYP' : { 'pop' :    0.941,	'ppp' :    33.486 },
	'CZE' : { 'pop' :   10.578,	'ppp' :   402.253 },
	'DNK' : { 'pop' :    5.72,	'ppp' :   313.046 },
	'DJI' : { 'pop' :    1.109,	'ppp' :     4.717 },
	'DMA' : { 'pop' :    0.071,	'ppp' :     0.96 },
	'DOM' : { 'pop' :   11.795,	'ppp' :   196.804 },
	'ECU' : { 'pop' :   17.511,	'ppp' :   248.518 },
	'EGY' : { 'pop' :   97.638,	'ppp' :  1369.489 },
	'SLV' : { 'pop' :    6.508,	'ppp' :    64.927 },
	'GNQ' : { 'pop' :    0.887,	'ppp' :    18.236 },
	'ERI' : { 'pop' :    7.941,	'ppp' :    10.228 },
	'EST' : { 'pop' :    1.297,	'ppp' :    47.898 },
	'ETH' : { 'pop' :  103.065,	'ppp' :   255.048 },
	'FJI' : { 'pop' :    0.912,	'ppp' :     9.675 },
	'FIN' : { 'pop' :    5.644,	'ppp' :   268.26 },
	'FRA' : { 'pop' :   65.699,	'ppp' :  3159.792 },
	'GAB' : { 'pop' :    1.721,	'ppp' :    55.55 },
	'GMB' : { 'pop' :    2.269,	'ppp' :     4.934 },
	'GEO' : { 'pop' :    4.37,	'ppp' :    48.289 },
	'DEU' : { 'pop' :   81.9,	'ppp' :  4500.566 },
	'GHA' : { 'pop' :   30.503,	'ppp' :   168.285 },
	'GRC' : { 'pop' :   10.924,	'ppp' :   377.911 },
	'GRD' : { 'pop' :    0.108,	'ppp' :     1.602 },
	'GTM' : { 'pop' :   18.404,	'ppp' :   166.378 },
	'GIN' : { 'pop' :   13.224,	'ppp' :    23.844 },
	'GNB' : { 'pop' :    1.989,	'ppp' :     3.522 },
	'GUY' : { 'pop' :    0.814,	'ppp' :     7.646 },
	'HTI' : { 'pop' :   11.288,	'ppp' :    25.17 },
	'HND' : { 'pop' :    9.332,	'ppp' :    53.702 },
	'HKG' : { 'pop' :    7.523,	'ppp' :   535.609 },
	'HUN' : { 'pop' :    9.759,	'ppp' :   312.597 },
	'ISL' : { 'pop' :    0.342,	'ppp' :    18.738 },
	'IND' : { 'pop' : 1362.457,	'ppp' : 12708.363 },
	'IDN' : { 'pop' :  273.791,	'ppp' :  4155.459 },
	'IRN' : { 'pop' :   84.185,	'ppp' :  1624.068 },
	'IRQ' : { 'pop' :   42.684,	'ppp' :   865.036 },
	'IRL' : { 'pop' :    4.848,	'ppp' :   299.047 },
	'ISR' : { 'pop' :    9.214,	'ppp' :   358.138 },
	'ITA' : { 'pop' :   61.413,	'ppp' :  2503.671 },
	'JAM' : { 'pop' :    2.891,	'ppp' :    30.853 },
	'JPN' : { 'pop' :  124.348,	'ppp' :  5521.726 },
	'JOR' : { 'pop' :    7.617,	'ppp' :   114.296 },
	'KAZ' : { 'pop' :   19.046,	'ppp' :   582.72 },
	'KEN' : { 'pop' :   50.153,	'ppp' :   219.931 },
	'KIR' : { 'pop' :    0.12,	'ppp' :     0.236 },
	'KOR' : { 'pop' :   51.74,	'ppp' :  2438.75 },
	'UVK' : { 'pop' :    2,		'ppp' :    22.973 },	# pop is a guess
	'KWT' : { 'pop' :    4.716,	'ppp' :   369.599 },
	'KGZ' : { 'pop' :    6.051,	'ppp' :    27.377 },
	'LAO' : { 'pop' :    7.723,	'ppp' :    58.972 },
	'LVA' : { 'pop' :    1.996,	'ppp' :    65.858 },
	'LBN' : { 'pop' :    4.777,	'ppp' :   108.587 },
	'LSO' : { 'pop' :    1.94,	'ppp' :     8.011 },
	'LBR' : { 'pop' :    4.838,	'ppp' :     6.022 },
	'LBY' : { 'pop' :    6.789,	'ppp' :   212.4 },
	'LTU' : { 'pop' :    2.857,	'ppp' :   108.022 },
	'LUX' : { 'pop' :    0.636,	'ppp' :    65.44 },
	'MKD' : { 'pop' :    2.09,	'ppp' :    38.695 },
	'MDG' : { 'pop' :   27.798,	'ppp' :    50.351 },
	'MWI' : { 'pop' :   20.873,	'ppp' :    21.406 },
	'MYS' : { 'pop' :   33.483,	'ppp' :  1106.955 },
	'MDV' : { 'pop' :    0.378,	'ppp' :     7.123 },
	'MLI' : { 'pop' :   19.074,	'ppp' :    41.353 },
	'MLT' : { 'pop' :    0.43,	'ppp' :    18.416 },
	'MHL' : { 'pop' :    0.06,	'ppp' :     0.224 },
	'MRT' : { 'pop' :    4.171,	'ppp' :    24.372 },
	'MUS' : { 'pop' :    1.26,	'ppp' :    31.859 },
	'MEX' : { 'pop' :  128.188,	'ppp' :  2924.975 },
	'FSM' : { 'pop' :    0.104,	'ppp' :     0.365 },
	'MDA' : { 'pop' :    3.557,	'ppp' :    23.306 },
	'MNG' : { 'pop' :    3.199,	'ppp' :    53.823 },
	'MNE' : { 'pop' :    0.631,	'ppp' :    12.454 },
	'MAR' : { 'pop' :   35.112,	'ppp' :   378.474 },
	'MOZ' : { 'pop' :   30.553,	'ppp' :    56.981 },
	'MMR' : { 'pop' :   53.722,	'ppp' :   427.585 },
	'NAM' : { 'pop' :    2.302,	'ppp' :    36.341 },
	'NPL' : { 'pop' :   30.102,	'ppp' :    97.467 },
	'NLD' : { 'pop' :   17.12,	'ppp' :   981.161 },
	'NZL' : { 'pop' :    4.749,	'ppp' :   205.53 },
	'NIC' : { 'pop' :    6.701,	'ppp' :    41.767 },
	'NER' : { 'pop' :   20.557,	'ppp' :    29.56 },
	'NGA' : { 'pop' :  204.684,	'ppp' :  1593.774 },
	'NOR' : { 'pop' :    5.506,	'ppp' :   424.377 },
	'OMN' : { 'pop' :    4.928,	'ppp' :   207.882 },
	'PAK' : { 'pop' :  208.824,	'ppp' :  1298.277 },
	'PLW' : { 'pop' :    0.019,	'ppp' :     0.367 },
	'PAN' : { 'pop' :    4.423,	'ppp' :   123.358 },
	'PNG' : { 'pop' :    8.732,	'ppp' :    28.364 },
	'PRY' : { 'pop' :    7.631,	'ppp' :    81.759 },
	'PER' : { 'pop' :   34.459,	'ppp' :   542.649 },
	'PHL' : { 'pop' :  111.979,	'ppp' :  1100.727 },
	'POL' : { 'pop' :   37.973,	'ppp' :  1306.513 },
	'PRT' : { 'pop' :   10.441,	'ppp' :   337.394 },
	'QAT' : { 'pop' :    2.78,	'ppp' :   484.828 },
	'ROU' : { 'pop' :   19.336,	'ppp' :   528.299 },
	'RUS' : { 'pop' :  143.7,	'ppp' :  3975.744 },
	'RWA' : { 'pop' :   12.934,	'ppp' :    31.991 },
	'WSM' : { 'pop' :    0.201,	'ppp' :     1.189 },
	'SMR' : { 'pop' :    0.031,	'ppp' :     2.272 },
	'STP' : { 'pop' :    0.227,	'ppp' :     0.957 },
	'SAU' : { 'pop' :   34.652,	'ppp' :  2136.824 },
	'SEN' : { 'pop' :   17.296,	'ppp' :    52.66 },
	'SRB' : { 'pop' :    7.164,	'ppp' :   121.68 },
	'SYC' : { 'pop' :    0.101,	'ppp' :     3.304 },
	'SLE' : { 'pop' :    6.894,	'ppp' :    17.196 },
	'SGP' : { 'pop' :    5.703,	'ppp' :   604.809 },
	'SVK' : { 'pop' :    5.457,	'ppp' :   203.402 },
	'SVN' : { 'pop' :    2.075,	'ppp' :    75.826 },
	'SLB' : { 'pop' :    0.655,	'ppp' :     1.475 },
	'ZAF' : { 'pop' :   59.362,	'ppp' :   905.474 },
	'SSD' : { 'pop' :   13.131,	'ppp' :    39.649 },
	'ESP' : { 'pop' :   46.062,	'ppp' :  1949.097 },
	'LKA' : { 'pop' :   21.838,	'ppp' :   352.288 },
	'KNA' : { 'pop' :    0.067,	'ppp' :     1.644 },
	'LCA' : { 'pop' :    0.176,	'ppp' :     2.452 },
	'VCT' : { 'pop' :    0.111,	'ppp' :     1.567 },
	'SDN' : { 'pop' :   44.345,	'ppp' :   231.166 },
	'SUR' : { 'pop' :    0.582,	'ppp' :    12.944 },
	'SWZ' : { 'pop' :    1.192,	'ppp' :    10.582 },
	'SWE' : { 'pop' :   10.254,	'ppp' :   580.23 },
	'CHE' : { 'pop' :    8.437,	'ppp' :   575.356 },
	'SYR' : { 'pop' :   15,		'ppp' :     0 },	# pop is a guess
	'TWN' : { 'pop' :   23.798,	'ppp' :  1517.568 },
	'TJK' : { 'pop' :    9.405,	'ppp' :    32.3 },
	'TZA' : { 'pop' :   56.915,	'ppp' :   211.873 },
	'THA' : { 'pop' :   69.305,	'ppp' :  1378.263 },
	'TLS' : { 'pop' :    1.473,	'ppp' :     4.873 },
	'TGO' : { 'pop' :    8.18,	'ppp' :    16.059 },
	'TON' : { 'pop' :    0.106,	'ppp' :     0.63 },
	'TTO' : { 'pop' :    1.392,	'ppp' :    53.148 },
	'TUN' : { 'pop' :   11.689,	'ppp' :   177.728 },
	'TUR' : { 'pop' :   81.699,	'ppp' :  2055.647 },
	'TKM' : { 'pop' :    6.375,	'ppp' :   149.77 },
	'TUV' : { 'pop' :    0.011,	'ppp' :     0.044 },
	'UGA' : { 'pop' :   45.501,	'ppp' :   120.387 },
	'UKR' : { 'pop' :   42.239,	'ppp' :   461.882 },
	'ARE' : { 'pop' :   11.077,	'ppp' :   821.732 },
	'GBR' : { 'pop' :   67.126,	'ppp' :  3240.196 },
	'USA' : { 'pop' :  332.194,	'ppp' : 22488.616 },
	'URY' : { 'pop' :    3.461,	'ppp' :    93.316 },
	'UZB' : { 'pop' :   32.875,	'ppp' :   277.342 },
	'VUT' : { 'pop' :    0.301,	'ppp' :     0.871 },
	'VEN' : { 'pop' :   33.429,	'ppp' :   510.501 },
	'VNM' : { 'pop' :   96.472,	'ppp' :   802.072 },
	'YEM' : { 'pop' :   32.471,	'ppp' :   141.357 },
	'ZMB' : { 'pop' :   18.252,	'ppp' :    99.645 },
	'ZWE' : { 'pop' :   14.16,	'ppp' :    36.63 }
}

IMFApr2015 = {
	'AFG' : { 'pop' :    31.279,	'ppp' :    60.578, },
	'ALB' : { 'pop' :     2.774,	'ppp' :    31.556, },
	'DZA' : { 'pop' :    38.7,	'ppp' :   551.809, },
	'AGO' : { 'pop' :    24.383,	'ppp' :   175.641, },
	'ATG' : { 'pop' :     0.088,	'ppp' :     1.994, },
	'ARG' : { 'pop' :    41.961,	'ppp' :   947.573, },
	'ARM' : { 'pop' :     3.293,	'ppp' :    24.282, },
	'AUS' : { 'pop' :    23.59,	'ppp' :  1095.384, },
	'AUT' : { 'pop' :     8.52,	'ppp' :   395.49, },
	'AZE' : { 'pop' :     9.383,	'ppp' :   165.32, },
	'BHS' : { 'pop' :     0.36,	'ppp' :     9.022, },
	'BHR' : { 'pop' :     1.198,	'ppp' :    61.939, },
	'BGD' : { 'pop' :   158.217,	'ppp' :   533.739, },
	'BRB' : { 'pop' :     0.279,	'ppp' :     4.516, },
	'BLR' : { 'pop' :     9.468,	'ppp' :   171.952, },
	'BEL' : { 'pop' :    11.204,	'ppp' :   481.474, },
	'BLZ' : { 'pop' :     0.357,	'ppp' :     2.942, },
	'BEN' : { 'pop' :    10.592,	'ppp' :    19.803, },
	'BTN' : { 'pop' :     0.766,	'ppp' :     5.855, },
	'BOL' : { 'pop' :    11.246,	'ppp' :    69.962, },
	'BIH' : { 'pop' :     3.871,	'ppp' :    38.064, },
	'BWA' : { 'pop' :     2.104,	'ppp' :    33.736, },
	'BRA' : { 'pop' :   202.769,	'ppp' :  3263.832, },
	'BRN' : { 'pop' :     0.413,	'ppp' :    30.212, },
	'BGR' : { 'pop' :     7.202,	'ppp' :   128.633, },
	'BFA' : { 'pop' :    17.429,	'ppp' :    29.309, },
	'BDI' : { 'pop' :     9.201,	'ppp' :     8.378, },
	'CPV' : { 'pop' :     0.518,	'ppp' :     3.279, },
	'KHM' : { 'pop' :    15.313,	'ppp' :    49.96, },
	'CMR' : { 'pop' :    22.544,	'ppp' :    67.2, },
	'CAN' : { 'pop' :    35.492,	'ppp' :  1591.58, },
	'CAF' : { 'pop' :     4.701,	'ppp' :     2.855, },
	'TCD' : { 'pop' :    11.284,	'ppp' :    29.533, },
	'CHL' : { 'pop' :    17.819,	'ppp' :   409.329, },
	'CHN' : { 'pop' :  1367.82,	'ppp' : 17617.321, },
	'COL' : { 'pop' :    47.662,	'ppp' :   640.122, },
	'COM' : { 'pop' :     0.776,	'ppp' :     1.202, },
	'COD' : { 'pop' :    79.301,	'ppp' :    55.807, },
	'COG' : { 'pop' :     4.274,	'ppp' :    28.036, },
	'CRI' : { 'pop' :     4.775,	'ppp' :    70.972, },
	'CIV' : { 'pop' :    22.717,	'ppp' :    71.122, },
	'HRV' : { 'pop' :     4.236,	'ppp' :    88.485, },
	'CUB' : { 'pop' :    11.210,	'ppp' :   212, },
	'CYP' : { 'pop' :     0.891,	'ppp' :    27.415, },
	'CZE' : { 'pop' :    10.512,	'ppp' :   314.585, },
	'DNK' : { 'pop' :     5.627,	'ppp' :   249.527, },
	'DJI' : { 'pop' :     0.939,	'ppp' :     2.865, },
	'DMA' : { 'pop' :     0.071,	'ppp' :     0.764, },
	'DOM' : { 'pop' :    10.602,	'ppp' :   137.953, },
	'ECU' : { 'pop' :    16.027,	'ppp' :   180.216, },
	'EGY' : { 'pop' :    86.7,	'ppp' :   943.052, },
	'SLV' : { 'pop' :     6.352,	'ppp' :    50.944, },
	'GNQ' : { 'pop' :     0.778,	'ppp' :    25.105, },
	'ERI' : { 'pop' :     6.537,	'ppp' :     7.814, },
	'EST' : { 'pop' :     1.319,	'ppp' :    35.621, },
	'ETH' : { 'pop' :    90.982,	'ppp' :   144.57, },
	'FJI' : { 'pop' :     0.885,	'ppp' :     7.293, },
	'FIN' : { 'pop' :     5.478,	'ppp' :   221.038, },
	'FRA' : { 'pop' :    63.92,	'ppp' :  2580.75, },
	'GAB' : { 'pop' :     1.586,	'ppp' :    36.349, },
	'GMB' : { 'pop' :     1.927,	'ppp' :     3.082, },
	'GEO' : { 'pop' :     4.47,	'ppp' :    34.209, },
	'DEU' : { 'pop' :    81.1,	'ppp' :  3721.551, },
	'GHA' : { 'pop' :    26.216,	'ppp' :   108.259, },
	'GRC' : { 'pop' :    10.993,	'ppp' :   284.255, },
	'GRD' : { 'pop' :     0.106,	'ppp' :     1.27, },
	'GTM' : { 'pop' :    15.87,	'ppp' :   119.077, },
	'GIN' : { 'pop' :    11.403,	'ppp' :    14.974, },
	'GNB' : { 'pop' :     1.738,	'ppp' :     2.495, },
	'GUY' : { 'pop' :     0.8,	'ppp' :     5.514, },
	'HTI' : { 'pop' :    10.461,	'ppp' :    18.308, },
	'HND' : { 'pop' :     8.264,	'ppp' :    39.081, },
	'HKG' : { 'pop' :     7.264,	'ppp' :   397.507, },
	'HUN' : { 'pop' :     9.877,	'ppp' :   246.354, },
	'ISL' : { 'pop' :     0.326,	'ppp' :    14.21, },
	'IND' : { 'pop' :  1259.695,	'ppp' :  7375.898, },
	'IDN' : { 'pop' :   251.49,	'ppp' :  2676.081, },
	'IRN' : { 'pop' :    77.969,	'ppp' :  1334.32, },
	'IRQ' : { 'pop' :    35.871,	'ppp' :   522.667, },
	'IRL' : { 'pop' :     4.61,	'ppp' :   226.768, },
	'ISR' : { 'pop' :     8.212,	'ppp' :   268.46, },
	'ITA' : { 'pop' :    59.96,	'ppp' :  2127.743, },
	'JAM' : { 'pop' :     2.799,	'ppp' :    24.097, },
	'JPN' : { 'pop' :   127.061,	'ppp' :  4750.771, },
	'JOR' : { 'pop' :     6.675,	'ppp' :    79.618, },
	'KAZ' : { 'pop' :    17.422,	'ppp' :   418.473, },
	'KEN' : { 'pop' :    42.927,	'ppp' :   132.406, },
	'KIR' : { 'pop' :     0.11,	'ppp' :     0.188, },
	'KOR' : { 'pop' :    50.424,	'ppp' :  1778.823, },
	'UVK' : { 'pop' :     1.859,	'ppp' :    16.857, },	# pop from Wikipedia
	'KWT' : { 'pop' :     3.999,	'ppp' :   283.976, },
	'KGZ' : { 'pop' :     5.7,	'ppp' :    19.159, },
	'LAO' : { 'pop' :     6.898,	'ppp' :    34.4, },
	'LVA' : { 'pop' :     2.033,	'ppp' :    48.185, },
	'LBN' : { 'pop' :     4.51,	'ppp' :    81.122, },
	'LSO' : { 'pop' :     1.911,	'ppp' :     5.282, },
	'LBR' : { 'pop' :     4.187,	'ppp' :     3.691, },
	'LBY' : { 'pop' :     6.213,	'ppp' :    97.58, },
	'LTU' : { 'pop' :     2.944,	'ppp' :    79.625, },
	'LUX' : { 'pop' :     0.559,	'ppp' :    51.411, },
	'MKD' : { 'pop' :     2.069,	'ppp' :    27.622, },
	'MDG' : { 'pop' :    23.572,	'ppp' :    33.865, },
	'MWI' : { 'pop' :    17.604,	'ppp' :    13.725, },
	'MYS' : { 'pop' :    30.262,	'ppp' :   746.078, },
	'MDV' : { 'pop' :     0.342,	'ppp' :     4.92, },
	'MLI' : { 'pop' :    15.791,	'ppp' :    27.308, },
	'MLT' : { 'pop' :     0.425,	'ppp' :    14.129, },
	'MHL' : { 'pop' :     0.054,	'ppp' :     0.181, },
	'MRT' : { 'pop' :     3.621,	'ppp' :    15.528, },
	'MUS' : { 'pop' :     1.259,	'ppp' :    23.357, },
	'MEX' : { 'pop' :   119.715,	'ppp' :  2140.564, },
	'FSM' : { 'pop' :     0.104,	'ppp' :     0.312, },
	'MDA' : { 'pop' :     3.558,	'ppp' :    17.715, },
	'MNG' : { 'pop' :     2.925,	'ppp' :    34.76, },
	'MNE' : { 'pop' :     0.624,	'ppp' :     9.36, },
	'MAR' : { 'pop' :    33.179,	'ppp' :   252.366, },
	'MOZ' : { 'pop' :    26.491,	'ppp' :    31.099, },
	'MMR' : { 'pop' :    51.419,	'ppp' :   241.98, },
	'NAM' : { 'pop' :     2.191,	'ppp' :    23.581, },
	'NPL' : { 'pop' :    28.109,	'ppp' :    66.775, },
	'NLD' : { 'pop' :    16.864,	'ppp' :   798.587, },
	'NZL' : { 'pop' :     4.519,	'ppp' :   158.864, },
	'NIC' : { 'pop' :     6.223,	'ppp' :    29.474, },
	'NER' : { 'pop' :    17.116,	'ppp' :    17.937, },
	'NGA' : { 'pop' :   173.938,	'ppp' :  1049.091, },
	'NOR' : { 'pop' :     5.156,	'ppp' :   345.16, },
	'OMN' : { 'pop' :     4.092,	'ppp' :   162.371, },
	'PAK' : { 'pop' :   186.289,	'ppp' :   882.313, },
	'PLW' : { 'pop' :     0.018,	'ppp' :     0.288, },
	'PAN' : { 'pop' :     3.928,	'ppp' :    76.416, },
	'PNG' : { 'pop' :     7.53,	'ppp' :    18.066, },
	'PRY' : { 'pop' :     6.901,	'ppp' :    58.301, },
	'PER' : { 'pop' :    31.424,	'ppp' :   371.344, },
	'PHL' : { 'pop' :    99.434,	'ppp' :   692.223, },
	'POL' : { 'pop' :    38.018,	'ppp' :   954.454, },
	'PRT' : { 'pop' :    10.393,	'ppp' :   280.36, },
	'QAT' : { 'pop' :     2.235,	'ppp' :   320.544, },
	'ROU' : { 'pop' :    19.926,	'ppp' :   392.773, },
	'RUS' : { 'pop' :   143.7,	'ppp' :  3564.549, },
	'RWA' : { 'pop' :    11.096,	'ppp' :    18.844, },
	'WSM' : { 'pop' :     0.192,	'ppp' :     0.994, },
	'SMR' : { 'pop' :     0.031,	'ppp' :     1.907, },
	'STP' : { 'pop' :     0.198,	'ppp' :     0.624, },
	'SAU' : { 'pop' :    30.77,	'ppp' :  1605.703, },
	'SEN' : { 'pop' :    14.54,	'ppp' :    33.606, },
	'SRB' : { 'pop' :     7.164,	'ppp' :    95.492, },
	'SYC' : { 'pop' :     0.094,	'ppp' :     2.406, },
	'SLE' : { 'pop' :     6.232,	'ppp' :    12.63, },
	'SGP' : { 'pop' :     5.47,	'ppp' :   452.686, },
	'SVK' : { 'pop' :     5.417,	'ppp' :   152.634, },
	'SVN' : { 'pop' :     2.061,	'ppp' :    61.127, },
	'SLB' : { 'pop' :     0.575,	'ppp' :     1.09, },
	'ZAF' : { 'pop' :    54.002,	'ppp' :   704.514, },
	'SSD' : { 'pop' :    11.384,	'ppp' :    25.957, },
	'ESP' : { 'pop' :    46.464,	'ppp' :  1566.369, },
	'LKA' : { 'pop' :    20.964,	'ppp' :   217.445, },
	'KNA' : { 'pop' :     0.06,	'ppp' :     1.258, },
	'LCA' : { 'pop' :     0.17,	'ppp' :     1.97, },
	'VCT' : { 'pop' :     0.11,	'ppp' :     1.184, },
	'SDN' : { 'pop' :    37.289,	'ppp' :   159.123, },
	'SUR' : { 'pop' :     0.553,	'ppp' :     9.188, },
	'SWZ' : { 'pop' :     1.106,	'ppp' :     8.621, },
	'SWE' : { 'pop' :     9.747,	'ppp' :   448.246, },
	'CHE' : { 'pop' :     8.14,	'ppp' :   472.83, },
	'SYR' : { 'pop' :    17.951,	'ppp' :     0, },	# pop from Wikipedia
	'TWN' : { 'pop' :    23.434,	'ppp' :  1074.525, },
	'TJK' : { 'pop' :     8.302,	'ppp' :    22.321, },
	'TZA' : { 'pop' :    47.665,	'ppp' :   127.109, },
	'THA' : { 'pop' :    68.657,	'ppp' :   985.516, },
	'TLS' : { 'pop' :     1.231,	'ppp' :     6.066, },
	'TGO' : { 'pop' :     6.998,	'ppp' :    10.144, },
	'TON' : { 'pop' :     0.102,	'ppp' :     0.5, },
	'TTO' : { 'pop' :     1.351,	'ppp' :    43.415, },
	'TUN' : { 'pop' :    10.998,	'ppp' :   124.274, },
	'TUR' : { 'pop' :    76.903,	'ppp' :  1508.102, },
	'TKM' : { 'pop' :     5.796,	'ppp' :    82.094, },
	'TUV' : { 'pop' :     0.011,	'ppp' :     0.035, },
	'UGA' : { 'pop' :    38.04,	'ppp' :    76.938, },
	'UKR' : { 'pop' :    42.775,	'ppp' :   370.786, },
	'ARE' : { 'pop' :     9.302,	'ppp' :   599.763, },
	'GBR' : { 'pop' :    64.511,	'ppp' :  2548.889, },
	'USA' : { 'pop' :   319.047,	'ppp' : 17418.925, },
	'URY' : { 'pop' :     3.404,	'ppp' :    69.978, },
	'UZB' : { 'pop' :    30.604,	'ppp' :   171.669, },
	'VUT' : { 'pop' :     0.263,	'ppp' :     0.685, },
	'VEN' : { 'pop' :    30.457,	'ppp' :   538.922, },
	'VNM' : { 'pop' :    90.63,	'ppp' :   510.689, },
	'YEM' : { 'pop' :    27.46,	'ppp' :   103.628, },
	'ZMB' : { 'pop' :    15.021,	'ppp' :    61.045, },
	'ZWE' : { 'pop' :    13.261,	'ppp' :    27.134, },
		
}

#	dliflc = {
#	        # http://www.dliflc.edu/archive/documents/DLICatalog2011_2012_NEW.pdf
#	        # 2011-2012 catalog, pages 39-41
#	        "AR" : 64,
#	        "ZH" : 64, "JA" : 64, "KO" : 64,
#	        "FR" : 26, "IT" : 26, "PT" : 26, "ES" : 26,
#	        "DE" : 35,
#	        "HE" : 48,
#	        "HI" : 48, "UR" : 48, "FA" : 48, "TH" : 48,
#	        "MY" : 35, "SW" : 35,
#	        "PA" : 64,
#	        "RU" : 48, "SR" : 48,
#	        "TG" : 48,
#	        "TR" : 48, "UZ" : 48,
#	        # estimated numbers for languages not taught by DLI
#	        "PO" : 48,      # = Russian
#	        "KZ" : 48,      # = Turkish
#	        "IS" : 35,	# = German
#		"GR" : 35,
#	        "Ng" : 26, "NO" : 26, "SV" : 26, "DA" : 26, "NL" : 26,  # based on FSI equivalents
#	}

fsiawl = {
        "AR" : 88,
        "ZH" : 88, "JA" : 88, "KO" : 88,
        "FR" : 24, "IT" : 24, "PT" : 24, "ES" : 24,
        "DE" : 30, "NL" : 24, "IS" : 44, 
        "Ng" : 24, "NO" : 24, "SV" : 24, "DA" : 24,
        "HE" : 44,
        "HI" : 44, "UR" : 44, "FA" : 44, "TH" : 52,
        "MY" : 36,
        "PA" : 44,
        "RU" : 44, "SR" : 44, "PO" : 44,
        "TG" : 44,
        "TR" : 44, "UZ" : 44,
	"GR" : 44,
        # estimated numbers for languages not taught by FSI
        "KZ" : 44,      # = Turkish
}

rexLC = re.compile('[A-Z][A-Za-z]')

MINIMUM_POPULATION = 0.0
MINIMUM_RATIO = 0.25

def popByLang(MIDDLE_CLASS, MINIMUM_POPULATION, showDetails,popAndPPPInfo):
	difficultyDict = fsiawl
	detailsByLang = {}
        byLang = {}
        bugzz = {}	# add an entry such as 'FR':1 to debug the range-analysis code for that language
        colonial = { 'EN' : 1, 'FR' : 1, 'PT' : 1, 'RU' : 1, 'NL' : 1 }
        for countryName in langinfo:
		if not countryName in popAndPPPInfo:
			continue

                ranges = False
                if countryName in brackets:
                        # country : [ year,GINI,top 10%,top 20%,2d 20%,3d 20%,4th 20%,low 20%,low 10% ]
                        B = brackets[countryName]
                        # ranges = ((0.0,0.0), 
                        ranges = ((0.0,(B[2]/100.0)*(1.0*B[2]/B[3])),
                                        # This is a hack to avoid having to figure out the second derivative, but it seems to work okay.
                                  (0.1,B[2]/100.0),
                                  (0.2,B[3]/100.0),
                                  (0.4,(B[3]+B[4])/100.0),
                                  (0.6,(B[3]+B[4]+B[5])/100.0),
                                  (0.8,1.0-B[7]/100.0),
                                  (0.9,1.0-B[8]/100.0),
                                  (1.0,1.0))
                G = langinfo[countryName]
                for key in G:
                        if rexLC.match(key):
                                if not key in byLang:
                                        byLang[key] = 0.0
                                X = 0.0
                                if popAndPPPInfo[countryName]['ppp']/popAndPPPInfo[countryName]['pop'] >= MIDDLE_CLASS:
                                        X = 1.0
                                elif ranges:
                                        for i in range(1,8):
                                                income = (popAndPPPInfo[countryName]['ppp']*ranges[i][1])/(popAndPPPInfo[countryName]['pop']*ranges[i][0])
                                                if key in bugzz: print "Step i=%d (%4.2f, %4.2f) = %6.2f" % (i, ranges[i][0], ranges[i][1], income)
                                                if income < MIDDLE_CLASS:
                                                        # Perform a brute force search assuming a linear function.
                                                        steps = int(round((ranges[i][0] - ranges[i-1][0])/0.01,0))
                                                        for j in range(1, steps+1):
                                                                Y = ranges[i-1][1] + (ranges[i][1]-ranges[i-1][1])*(1.0*j/steps)
                                                                Z = ranges[i-1][0] + (ranges[i][0]-ranges[i-1][0])*(1.0*j/steps)
                                                                income = (popAndPPPInfo[countryName]['ppp']*Y)/(popAndPPPInfo[countryName]['pop']*Z) 
                                                                if key in bugzz: print "Step j=%d, income = %6.2f" % (j, income)
                                                                if income < MIDDLE_CLASS:
                                                                        X = ranges[i-1][0] + 0.01*j - 0.01
                                                                        break
                                                        break

                                A = popAndPPPInfo[countryName]['pop']*G[key]*X
                                if key in colonial and 'colonial' in G and G['colonial']:
                                        # In Africa and Asia, if a colonial language continues as an official language or the language of
                                        # higher education, assume that the elite strata of society will have much greater fluency in the 
                                        # colonial language.
                                        Y = min(X,G[key])
                                        A = popAndPPPInfo[countryName]['pop']*Y
                                        if key in bugzz: print "X = %4.2f, G[key] = %4.2f, using %4.2f" % (X, G[key], Y)
                                        X = Y
                                byLang[key] = byLang[key] + A
				if key in showDetails:
					if key not in detailsByLang: detailsByLang[key] = []
					detailsByLang[key].append((-A, G[key], popAndPPPInfo[countryName]['pop'], 100*X, countryName))

        tupz = []
        for x in byLang.items():
                lang = x[0]
                pop = x[1]
		dif = 48.0
		if fsiawl == difficultyDict:
			dif = 44.0
		if x[0] in difficultyDict:
			dif = difficultyDict[x[0]]
		eff = pop/dif
                if pop >= MINIMUM_POPULATION and eff >= MINIMUM_RATIO:
                        tupz.append((eff,lang,pop,dif))
        tupz.sort()
        tupz.reverse()
        for x in tupz:
                if 'EN' == x[1]:
                        print "%s = %6.1f" % (x[1], x[2])
                else:
                        print "%s = %6.1f / %d = %6.2f" % (x[1], x[2], x[3], x[0])

	if len(detailsByLang) > 0:
		for lang in detailsByLang.keys():
			print "------------------------------------------------------------"
			detailsByLang[lang].sort()
			for line in detailsByLang[lang]:
                                print "%s %4.2f of pop %6.1f, %3.0f%% = %6.1f, %s" % (lang, line[1], line[2], line[3], -line[0], countryCodes[line[4]])


# showDetails = {'RU':1}
showDetails = {}

if len(sys.argv) > 1:
	for x in sys.argv[1].split(','):
		showDetails[x] = 1

popByLang(20, 5, showDetails,IMFApr2015)
# popByLang(20, 5, showDetails,IMFEst2020)