code: public String getRulesIdForLocale(ULocale locale, PluralType type) {
          Map<String, String> idMap = getLocaleIdToRulesIdMap(type);
          String localeId = ULocale.canonicalize(locale.getBaseName());
          String rulesId = null;
          while (null == (rulesId = idMap.get(localeId))) {
              int ix = localeId.lastIndexOf("_");
              if (ix == -1) {
                  break;
              }
              localeId = localeId.substring(0, ix);
          }
          return rulesId;
      }
docs: Gets the rulesId from the locale,with locale fallback. If there is no
  rulesId, return null. The rulesId might be the empty string if the rule
  is the default rule.