Skip to content

Instantly share code, notes, and snippets.

@demirdegerli
Created January 3, 2026 13:55
Show Gist options
  • Select an option

  • Save demirdegerli/69e143be18e0b941f2b11284a0503714 to your computer and use it in GitHub Desktop.

Select an option

Save demirdegerli/69e143be18e0b941f2b11284a0503714 to your computer and use it in GitHub Desktop.
Parser script for Tor Snowflake Metrics API
import re
import requests
# Replace with your actual metrics endpoint
url = "http://ubuntu:1080/internal/metrics"
url2 = "http://192.168.1.2:1080/internal/metrics"
# Download metrics text
resp = None
try:
resp = requests.get(url)
except:
resp = requests.get(url2)
metrics = resp.text
# Parse relevant metrics
timeouts = 0
total_connections = 0
connections_by_country = {}
inbound = 0
outbound = 0
for line in metrics.splitlines():
if line.startswith("tor_snowflake_proxy_connection_timeouts_total"):
timeouts = int(float(line.split()[-1]))
elif line.startswith("tor_snowflake_proxy_connections_total"):
match = re.search(r'country="([A-Z]{2})"', line)
country = match.group(1) if match else "?"
count = int(float(line.split()[-1]))
connections_by_country[country] = connections_by_country.get(country, 0) + count
total_connections += count
elif line.startswith("tor_snowflake_proxy_traffic_inbound_bytes_total"):
inbound = int(float(line.split()[-1]))
elif line.startswith("tor_snowflake_proxy_traffic_outbound_bytes_total"):
outbound = int(float(line.split()[-1]))
# Manual ISO country name + emoji flag
country_map = {
"?": "Unknown [?]",
"AW": "Aruba ๐Ÿ‡ฆ๐Ÿ‡ผ",
"AF": "Afghanistan ๐Ÿ‡ฆ๐Ÿ‡ซ",
"AO": "Angola ๐Ÿ‡ฆ๐Ÿ‡ด",
"AI": "Anguilla ๐Ÿ‡ฆ๐Ÿ‡ฎ",
"AX": "ร…land Islands ๐Ÿ‡ฆ๐Ÿ‡ฝ",
"AL": "Albania ๐Ÿ‡ฆ๐Ÿ‡ฑ",
"AD": "Andorra ๐Ÿ‡ฆ๐Ÿ‡ฉ",
"AE": "United Arab Emirates ๐Ÿ‡ฆ๐Ÿ‡ช",
"AR": "Argentina ๐Ÿ‡ฆ๐Ÿ‡ท",
"AM": "Armenia ๐Ÿ‡ฆ๐Ÿ‡ฒ",
"AS": "American Samoa ๐Ÿ‡ฆ๐Ÿ‡ธ",
"AQ": "Antarctica ๐Ÿ‡ฆ๐Ÿ‡ถ",
"TF": "French Southern Territories ๐Ÿ‡น๐Ÿ‡ซ",
"AG": "Antigua and Barbuda ๐Ÿ‡ฆ๐Ÿ‡ฌ",
"AU": "Australia ๐Ÿ‡ฆ๐Ÿ‡บ",
"AT": "Austria ๐Ÿ‡ฆ๐Ÿ‡น",
"AZ": "Azerbaijan ๐Ÿ‡ฆ๐Ÿ‡ฟ",
"BI": "Burundi ๐Ÿ‡ง๐Ÿ‡ฎ",
"BE": "Belgium ๐Ÿ‡ง๐Ÿ‡ช",
"BJ": "Benin ๐Ÿ‡ง๐Ÿ‡ฏ",
"BF": "Burkina Faso ๐Ÿ‡ง๐Ÿ‡ซ",
"BD": "Bangladesh ๐Ÿ‡ง๐Ÿ‡ฉ",
"BG": "Bulgaria ๐Ÿ‡ง๐Ÿ‡ฌ",
"BH": "Bahrain ๐Ÿ‡ง๐Ÿ‡ญ",
"BS": "Bahamas ๐Ÿ‡ง๐Ÿ‡ธ",
"BA": "Bosnia and Herzegovina ๐Ÿ‡ง๐Ÿ‡ฆ",
"BY": "Belarus ๐Ÿ‡ง๐Ÿ‡พ",
"BZ": "Belize ๐Ÿ‡ง๐Ÿ‡ฟ",
"BM": "Bermuda ๐Ÿ‡ง๐Ÿ‡ฒ",
"BO": "Bolivia ๐Ÿ‡ง๐Ÿ‡ด",
"BR": "Brazil ๐Ÿ‡ง๐Ÿ‡ท",
"BB": "Barbados ๐Ÿ‡ง๐Ÿ‡ง",
"BN": "Brunei Darussalam ๐Ÿ‡ง๐Ÿ‡ณ",
"BT": "Bhutan ๐Ÿ‡ง๐Ÿ‡น",
"BV": "Bouvet Island ๐Ÿ‡ง๐Ÿ‡ป",
"BW": "Botswana ๐Ÿ‡ง๐Ÿ‡ผ",
"CF": "Central African Republic ๐Ÿ‡จ๐Ÿ‡ซ",
"CA": "Canada ๐Ÿ‡จ๐Ÿ‡ฆ",
"CC": "Cocos (Keeling) Islands ๐Ÿ‡จ๐Ÿ‡จ",
"CH": "Switzerland ๐Ÿ‡จ๐Ÿ‡ญ",
"CL": "Chile ๐Ÿ‡จ๐Ÿ‡ฑ",
"CN": "China ๐Ÿ‡จ๐Ÿ‡ณ",
"CI": "Cรดte d'Ivoire ๐Ÿ‡จ๐Ÿ‡ฎ",
"CM": "Cameroon ๐Ÿ‡จ๐Ÿ‡ฒ",
"CD": "Congo, The Democratic Republic of the ๐Ÿ‡จ๐Ÿ‡ฉ",
"CG": "Congo ๐Ÿ‡จ๐Ÿ‡ฌ",
"CK": "Cook Islands ๐Ÿ‡จ๐Ÿ‡ฐ",
"CO": "Colombia ๐Ÿ‡จ๐Ÿ‡ด",
"KM": "Comoros ๐Ÿ‡ฐ๐Ÿ‡ฒ",
"CV": "Cabo Verde ๐Ÿ‡จ๐Ÿ‡ป",
"CR": "Costa Rica ๐Ÿ‡จ๐Ÿ‡ท",
"CU": "Cuba ๐Ÿ‡จ๐Ÿ‡บ",
"CW": "Curaรงao ๐Ÿ‡จ๐Ÿ‡ผ",
"CX": "Christmas Island ๐Ÿ‡จ๐Ÿ‡ฝ",
"CY": "Cyprus ๐Ÿ‡จ๐Ÿ‡พ",
"CZ": "Czechia ๐Ÿ‡จ๐Ÿ‡ฟ",
"DE": "Germany ๐Ÿ‡ฉ๐Ÿ‡ช",
"DJ": "Djibouti ๐Ÿ‡ฉ๐Ÿ‡ฏ",
"DM": "Dominica ๐Ÿ‡ฉ๐Ÿ‡ฒ",
"DK": "Denmark ๐Ÿ‡ฉ๐Ÿ‡ฐ",
"DO": "Dominican Republic ๐Ÿ‡ฉ๐Ÿ‡ด",
"DZ": "Algeria ๐Ÿ‡ฉ๐Ÿ‡ฟ",
"EC": "Ecuador ๐Ÿ‡ช๐Ÿ‡จ",
"EG": "Egypt ๐Ÿ‡ช๐Ÿ‡ฌ",
"ER": "Eritrea ๐Ÿ‡ช๐Ÿ‡ท",
"EH": "Western Sahara ๐Ÿ‡ช๐Ÿ‡ญ",
"ES": "Spain ๐Ÿ‡ช๐Ÿ‡ธ",
"EE": "Estonia ๐Ÿ‡ช๐Ÿ‡ช",
"ET": "Ethiopia ๐Ÿ‡ช๐Ÿ‡น",
"FI": "Finland ๐Ÿ‡ซ๐Ÿ‡ฎ",
"FJ": "Fiji ๐Ÿ‡ซ๐Ÿ‡ฏ",
"FK": "Falkland Islands ๐Ÿ‡ซ๐Ÿ‡ฐ",
"FM": "Micronesia ๐Ÿ‡ซ๐Ÿ‡ฒ",
"FO": "Faroe Islands ๐Ÿ‡ซ๐Ÿ‡ด",
"FR": "France ๐Ÿ‡ซ๐Ÿ‡ท",
"GA": "Gabon ๐Ÿ‡ฌ๐Ÿ‡ฆ",
"GB": "United Kingdom ๐Ÿ‡ฌ๐Ÿ‡ง",
"GE": "Georgia ๐Ÿ‡ฌ๐Ÿ‡ช",
"GG": "Guernsey ๐Ÿ‡ฌ๐Ÿ‡ฌ",
"GH": "Ghana ๐Ÿ‡ฌ๐Ÿ‡ญ",
"GI": "Gibraltar ๐Ÿ‡ฌ๐Ÿ‡ฎ",
"GN": "Guinea ๐Ÿ‡ฌ๐Ÿ‡ณ",
"GP": "Guadeloupe ๐Ÿ‡ฌ๐Ÿ‡ต",
"GM": "Gambia ๐Ÿ‡ฌ๐Ÿ‡ฒ",
"GW": "Guinea-Bissau ๐Ÿ‡ฌ๐Ÿ‡ผ",
"GQ": "Equatorial Guinea ๐Ÿ‡ฌ๐Ÿ‡ถ",
"GR": "Greece ๐Ÿ‡ฌ๐Ÿ‡ท",
"GD": "Grenada ๐Ÿ‡ฌ๐Ÿ‡ฉ",
"GL": "Greenland ๐Ÿ‡ฌ๐Ÿ‡ฑ",
"GT": "Guatemala ๐Ÿ‡ฌ๐Ÿ‡น",
"GF": "French Guiana ๐Ÿ‡ฌ๐Ÿ‡ซ",
"GU": "Guam ๐Ÿ‡ฌ๐Ÿ‡บ",
"GY": "Guyana ๐Ÿ‡ฌ๐Ÿ‡พ",
"HK": "Hong Kong ๐Ÿ‡ญ๐Ÿ‡ฐ",
"HM": "Heard Island and McDonald Islands ๐Ÿ‡ญ๐Ÿ‡ฒ",
"HN": "Honduras ๐Ÿ‡ญ๐Ÿ‡ณ",
"HR": "Croatia ๐Ÿ‡ญ๐Ÿ‡ท",
"HT": "Haiti ๐Ÿ‡ญ๐Ÿ‡น",
"HU": "Hungary ๐Ÿ‡ญ๐Ÿ‡บ",
"ID": "Indonesia ๐Ÿ‡ฎ๐Ÿ‡ฉ",
"IM": "Isle of Man ๐Ÿ‡ฎ๐Ÿ‡ฒ",
"IN": "India ๐Ÿ‡ฎ๐Ÿ‡ณ",
"IO": "British Indian Ocean Territory ๐Ÿ‡ฎ๐Ÿ‡ด",
"IE": "Ireland ๐Ÿ‡ฎ๐Ÿ‡ช",
"IR": "Iran ๐Ÿ‡ฎ๐Ÿ‡ท",
"IQ": "Iraq ๐Ÿ‡ฎ๐Ÿ‡ถ",
"IS": "Iceland ๐Ÿ‡ฎ๐Ÿ‡ธ",
"IL": "Israel ๐Ÿ‡ฎ๐Ÿ‡ฑ",
"IT": "Italy ๐Ÿ‡ฎ๐Ÿ‡น",
"JM": "Jamaica ๐Ÿ‡ฏ๐Ÿ‡ฒ",
"JE": "Jersey ๐Ÿ‡ฏ๐Ÿ‡ช",
"JO": "Jordan ๐Ÿ‡ฏ๐Ÿ‡ด",
"JP": "Japan ๐Ÿ‡ฏ๐Ÿ‡ต",
"KZ": "Kazakhstan ๐Ÿ‡ฐ๐Ÿ‡ฟ",
"KE": "Kenya ๐Ÿ‡ฐ๐Ÿ‡ช",
"KG": "Kyrgyzstan ๐Ÿ‡ฐ๐Ÿ‡ฌ",
"KH": "Cambodia ๐Ÿ‡ฐ๐Ÿ‡ญ",
"KI": "Kiribati ๐Ÿ‡ฐ๐Ÿ‡ฎ",
"KN": "Saint Kitts and Nevis ๐Ÿ‡ฐ๐Ÿ‡ณ",
"KR": "Korea, Republic of ๐Ÿ‡ฐ๐Ÿ‡ท",
"KW": "Kuwait ๐Ÿ‡ฐ๐Ÿ‡ผ",
"LA": "Lao People's Democratic Republic ๐Ÿ‡ฑ๐Ÿ‡ฆ",
"LB": "Lebanon ๐Ÿ‡ฑ๐Ÿ‡ง",
"LR": "Liberia ๐Ÿ‡ฑ๐Ÿ‡ท",
"LY": "Libya ๐Ÿ‡ฑ๐Ÿ‡พ",
"LC": "Saint Lucia ๐Ÿ‡ฑ๐Ÿ‡จ",
"LI": "Liechtenstein ๐Ÿ‡ฑ๐Ÿ‡ฎ",
"LK": "Sri Lanka ๐Ÿ‡ฑ๐Ÿ‡ฐ",
"LS": "Lesotho ๐Ÿ‡ฑ๐Ÿ‡ธ",
"LT": "Lithuania ๐Ÿ‡ฑ๐Ÿ‡น",
"LU": "Luxembourg ๐Ÿ‡ฑ๐Ÿ‡บ",
"LV": "Latvia ๐Ÿ‡ฑ๐Ÿ‡ป",
"MO": "Macao ๐Ÿ‡ฒ๐Ÿ‡ด",
"MF": "Saint Martin ๐Ÿ‡ฒ๐Ÿ‡ซ",
"MA": "Morocco ๐Ÿ‡ฒ๐Ÿ‡ฆ",
"MC": "Monaco ๐Ÿ‡ฒ๐Ÿ‡จ",
"MD": "Moldova ๐Ÿ‡ฒ๐Ÿ‡ฉ",
"MG": "Madagascar ๐Ÿ‡ฒ๐Ÿ‡ฌ",
"MV": "Maldives ๐Ÿ‡ฒ๐Ÿ‡ป",
"MX": "Mexico ๐Ÿ‡ฒ๐Ÿ‡ฝ",
"MH": "Marshall Islands ๐Ÿ‡ฒ๐Ÿ‡ญ",
"MK": "North Macedonia ๐Ÿ‡ฒ๐Ÿ‡ฐ",
"ML": "Mali ๐Ÿ‡ฒ๐Ÿ‡ฑ",
"MT": "Malta ๐Ÿ‡ฒ๐Ÿ‡น",
"MM": "Myanmar ๐Ÿ‡ฒ๐Ÿ‡ฒ",
"ME": "Montenegro ๐Ÿ‡ฒ๐Ÿ‡ช",
"MN": "Mongolia ๐Ÿ‡ฒ๐Ÿ‡ณ",
"MP": "Northern Mariana Islands ๐Ÿ‡ฒ๐Ÿ‡ต",
"MZ": "Mozambique ๐Ÿ‡ฒ๐Ÿ‡ฟ",
"MR": "Mauritania ๐Ÿ‡ฒ๐Ÿ‡ท",
"MS": "Montserrat ๐Ÿ‡ฒ๐Ÿ‡ธ",
"MQ": "Martinique ๐Ÿ‡ฒ๐Ÿ‡ถ",
"MU": "Mauritius ๐Ÿ‡ฒ๐Ÿ‡บ",
"MW": "Malawi ๐Ÿ‡ฒ๐Ÿ‡ผ",
"MY": "Malaysia ๐Ÿ‡ฒ๐Ÿ‡พ",
"YT": "Mayotte ๐Ÿ‡พ๐Ÿ‡น",
"NA": "Namibia ๐Ÿ‡ณ๐Ÿ‡ฆ",
"NC": "New Caledonia ๐Ÿ‡ณ๐Ÿ‡จ",
"NE": "Niger ๐Ÿ‡ณ๐Ÿ‡ช",
"NF": "Norfolk Island ๐Ÿ‡ณ๐Ÿ‡ซ",
"NG": "Nigeria ๐Ÿ‡ณ๐Ÿ‡ฌ",
"NI": "Nicaragua ๐Ÿ‡ณ๐Ÿ‡ฎ",
"NL": "Netherlands ๐Ÿ‡ณ๐Ÿ‡ฑ",
"NO": "Norway ๐Ÿ‡ณ๐Ÿ‡ด",
"NP": "Nepal ๐Ÿ‡ณ๐Ÿ‡ต",
"NR": "Nauru ๐Ÿ‡ณ๐Ÿ‡ท",
"NU": "Niue ๐Ÿ‡ณ๐Ÿ‡บ",
"NZ": "New Zealand ๐Ÿ‡ณ๐Ÿ‡ฟ",
"OM": "Oman ๐Ÿ‡ด๐Ÿ‡ฒ",
"PK": "Pakistan ๐Ÿ‡ต๐Ÿ‡ฐ",
"PA": "Panama ๐Ÿ‡ต๐Ÿ‡ฆ",
"PN": "Pitcairn ๐Ÿ‡ต๐Ÿ‡ณ",
"PE": "Peru ๐Ÿ‡ต๐Ÿ‡ช",
"PH": "Philippines ๐Ÿ‡ต๐Ÿ‡ญ",
"PW": "Palau ๐Ÿ‡ต๐Ÿ‡ผ",
"PG": "Papua New Guinea ๐Ÿ‡ต๐Ÿ‡ฌ",
"PL": "Poland ๐Ÿ‡ต๐Ÿ‡ฑ",
"PR": "Puerto Rico ๐Ÿ‡ต๐Ÿ‡ท",
"KP": "Korea, Democratic People's Republic of ๐Ÿ‡ฐ๐Ÿ‡ต",
"PT": "Portugal ๐Ÿ‡ต๐Ÿ‡น",
"PY": "Paraguay ๐Ÿ‡ต๐Ÿ‡พ",
"PS": "Palestine, State of ๐Ÿ‡ต๐Ÿ‡ธ",
"QA": "Qatar ๐Ÿ‡ถ๐Ÿ‡ฆ",
"RE": "Rรฉunion ๐Ÿ‡ท๐Ÿ‡ช",
"RO": "Romania ๐Ÿ‡ท๐Ÿ‡ด",
"RU": "Russia ๐Ÿ‡ท๐Ÿ‡บ",
"RW": "Rwanda ๐Ÿ‡ท๐Ÿ‡ผ",
"SA": "Saudi Arabia ๐Ÿ‡ธ๐Ÿ‡ฆ",
"SD": "Sudan ๐Ÿ‡ธ๐Ÿ‡ฉ",
"SN": "Senegal ๐Ÿ‡ธ๐Ÿ‡ณ",
"SG": "Singapore ๐Ÿ‡ธ๐Ÿ‡ฌ",
"GS": "South Georgia and the South Sandwich Islands ๐Ÿ‡ฌ๐Ÿ‡ธ",
"SH": "Saint Helena, Ascension and Tristan da Cunha ๐Ÿ‡ธ๐Ÿ‡ญ",
"SJ": "Svalbard and Jan Mayen ๐Ÿ‡ธ๐Ÿ‡ฏ",
"SB": "Solomon Islands ๐Ÿ‡ธ๐Ÿ‡ง",
"SL": "Sierra Leone ๐Ÿ‡ธ๐Ÿ‡ฑ",
"SV": "El Salvador ๐Ÿ‡ธ๐Ÿ‡ป",
"SM": "San Marino ๐Ÿ‡ธ๐Ÿ‡ฒ",
"SO": "Somalia ๐Ÿ‡ธ๐Ÿ‡ด",
"PM": "Saint Pierre and Miquelon ๐Ÿ‡ต๐Ÿ‡ฒ",
"RS": "Serbia ๐Ÿ‡ท๐Ÿ‡ธ",
"SS": "South Sudan ๐Ÿ‡ธ๐Ÿ‡ธ",
"ST": "Sao Tome and Principe ๐Ÿ‡ธ๐Ÿ‡น",
"SR": "Suriname ๐Ÿ‡ธ๐Ÿ‡ท",
"SK": "Slovakia ๐Ÿ‡ธ๐Ÿ‡ฐ",
"SI": "Slovenia ๐Ÿ‡ธ๐Ÿ‡ฎ",
"SE": "Sweden ๐Ÿ‡ธ๐Ÿ‡ช",
"SZ": "Eswatini ๐Ÿ‡ธ๐Ÿ‡ฟ",
"SX": "Sint Maarten ๐Ÿ‡ธ๐Ÿ‡ฝ",
"SC": "Seychelles ๐Ÿ‡ธ๐Ÿ‡จ",
"SY": "Syrian Arab Republic ๐Ÿ‡ธ๐Ÿ‡พ",
"TC": "Turks and Caicos Islands ๐Ÿ‡น๐Ÿ‡จ",
"TD": "Chad ๐Ÿ‡น๐Ÿ‡ฉ",
"TG": "Togo ๐Ÿ‡น๐Ÿ‡ฌ",
"TH": "Thailand ๐Ÿ‡น๐Ÿ‡ญ",
"TJ": "Tajikistan ๐Ÿ‡น๐Ÿ‡ฏ",
"TK": "Tokelau ๐Ÿ‡น๐Ÿ‡ฐ",
"TM": "Turkmenistan ๐Ÿ‡น๐Ÿ‡ฒ",
"TL": "Timor-Leste ๐Ÿ‡น๐Ÿ‡ฑ",
"TO": "Tonga ๐Ÿ‡น๐Ÿ‡ด",
"TT": "Trinidad and Tobago ๐Ÿ‡น๐Ÿ‡น",
"TN": "Tunisia ๐Ÿ‡น๐Ÿ‡ณ",
"TR": "Tรผrkiye ๐Ÿ‡น๐Ÿ‡ท",
"TW": "Taiwan ๐Ÿ‡น๐Ÿ‡ผ",
"TV": "Tuvalu ๐Ÿ‡น๐Ÿ‡ป",
"TZ": "Tanzania ๐Ÿ‡น๐Ÿ‡ฟ",
"UG": "Uganda ๐Ÿ‡บ๐Ÿ‡ฌ",
"UA": "Ukraine ๐Ÿ‡บ๐Ÿ‡ฆ",
"UM": "United States Minor Outlying Islands ๐Ÿ‡บ๐Ÿ‡ฒ",
"UY": "Uruguay ๐Ÿ‡บ๐Ÿ‡พ",
"US": "United States ๐Ÿ‡บ๐Ÿ‡ธ",
"UZ": "Uzbekistan ๐Ÿ‡บ๐Ÿ‡ฟ",
"VA": "Holy See ๐Ÿ‡ป๐Ÿ‡ฆ",
"VC": "Saint Vincent and the Grenadines ๐Ÿ‡ป๐Ÿ‡จ",
"VE": "Venezuela ๐Ÿ‡ป๐Ÿ‡ช",
"VG": "Virgin Islands, British ๐Ÿ‡ป๐Ÿ‡ฌ",
"VI": "Virgin Islands, U.S. ๐Ÿ‡ป๐Ÿ‡ฎ",
"VN": "Vietnam ๐Ÿ‡ป๐Ÿ‡ณ",
"VU": "Vanuatu ๐Ÿ‡ป๐Ÿ‡บ",
"WF": "Wallis and Futuna ๐Ÿ‡ผ๐Ÿ‡ซ",
"WS": "Samoa ๐Ÿ‡ผ๐Ÿ‡ธ",
"YE": "Yemen ๐Ÿ‡พ๐Ÿ‡ช",
"ZA": "South Africa ๐Ÿ‡ฟ๐Ÿ‡ฆ",
"ZM": "Zambia ๐Ÿ‡ฟ๐Ÿ‡ฒ",
"ZW": "Zimbabwe ๐Ÿ‡ฟ๐Ÿ‡ผ"
}
# Auto-scaling display for values in KB
def format_bytes_from_kb(kb_val):
units = ["KB", "MB", "GB", "TB"]
size = float(kb_val)
for unit in units:
if size < 1000:
return f"{size:.2f} {unit}"
size /= 1000
return f"{size:.2f} PB"
# Print summary
print("\n==== Snowflake Proxy Metrics Summary ====\n")
print(f"{'Total Successful Connections':<30}: {total_connections}")
print(f"{'Connection Timeouts':<30}: {timeouts}")
print(f"{'Inbound Traffic':<30}: {format_bytes_from_kb(inbound)}")
print(f"{'Outbound Traffic':<30}: {format_bytes_from_kb(outbound)}")
# Print country-wise table
print("\n=== Connections by Country ===\n")
print(f"{'Country':<27} {'Connections':>12}")
print("-" * 40)
for code, count in sorted(connections_by_country.items(), key=lambda x: x[1], reverse=True):
name = country_map.get(code, f"{code} [?]")
print(f"{name:<27} {count:>12}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment