code: public static String getCanonicalCountry(String tzid, Output<Boolean> isPrimary) {
          isPrimary.value = Boolean.FALSE;
  
          String country = getRegion(tzid);
          if (country != null && country.equals(kWorld)) {
              return null;
          }
  
          // Check the cache
          Boolean singleZone = SINGLE_COUNTRY_CACHE.get(tzid);
          if (singleZone == null) {
              Set<String> ids = TimeZone.getAvailableIDs(SystemTimeZoneType.CANONICAL_LOCATION, country, null);
              assert(ids.size() >= 1);
              singleZone = Boolean.valueOf(ids.size() <= 1);
              SINGLE_COUNTRY_CACHE.put(tzid, singleZone);
          }
  
          if (singleZone) {
              isPrimary.value = Boolean.TRUE;
          } else {
              // Note: We may cache the primary zone map in future.
  
              // Even a country has multiple zones, one of them might be
              // dominant and treated as a primary zone.
              try {
                  UResourceBundle bundle = UResourceBundle.getBundleInstance(ICUData.ICU_BASE_NAME, "metaZones");
                  UResourceBundle primaryZones = bundle.get("primaryZones");
                  String primaryZone = primaryZones.getString(country);
                  if (tzid.equals(primaryZone)) {
                      isPrimary.value = Boolean.TRUE;
                  } else {
                      // The given ID might not be a canonical ID
                      String canonicalID = getCanonicalCLDRID(tzid);
                      if (canonicalID != null && canonicalID.equals(primaryZone)) {
                          isPrimary.value = Boolean.TRUE;
                      }
                  }
              } catch (MissingResourceException e) {
                  // ignore
              }
          }
  
          return country;
      }
docs: Return the canonical country code for this tzid.  If we have none, or if the time zone
  is not associated with a country or unknown, return null. When the given zone is the
  primary zone of the country, true is set to isPrimary.