code: func IsValidNumberForRegion(number *PhoneNumber, regionCode string) bool {
  	var countryCode int = int(number.GetCountryCode())
  	var metadata *PhoneMetadata = getMetadataForRegionOrCallingCode(
  		countryCode, regionCode)
  	if metadata == nil ||
  		(REGION_CODE_FOR_NON_GEO_ENTITY != regionCode &&
  			countryCode != getCountryCodeForValidRegion(regionCode)) {
  		// Either the region code was invalid, or the country calling
  		// code for this number does not match that of the region code.
  		return false
  	}
  	var generalNumDesc *PhoneNumberDesc = metadata.GetGeneralDesc()
  	var nationalSignificantNumber string = GetNationalSignificantNumber(number)
  	// For regions where we don't have metadata for PhoneNumberDesc, we
  	// treat any number passed in as a valid number if its national
  	// significant number is between the minimum and maximum lengths
  	// defined by ITU for a national significant number.
  	if len(generalNumDesc.GetNationalNumberPattern()) == 0 {
  		var numberLength int = len(nationalSignificantNumber)
  		return numberLength > MIN_LENGTH_FOR_NSN &&
  			numberLength <= MAX_LENGTH_FOR_NSN
  	}
  	return getNumberTypeHelper(nationalSignificantNumber, metadata) != UNKNOWN
  }
docs: // Tests whether a phone number is valid for a certain region. Note this
  // doesn't verify the number is actually in use, which is impossible to
  // tell by just looking at a number itself. If the country calling code is
  // not the same as the country calling code for the region, this immediately
  // exits with false. After this, the specific number pattern rules for the
  // region are examined. This is useful for determining for example whether
  // a particular number is valid for Canada, rather than just a valid NANPA
  // number.
  // Warning: In most cases, you want to use IsValidNumber() instead. For
  // example, this method will mark numbers from British Crown dependencies
  // such as the Isle of Man as invalid for the region "GB" (United Kingdom),
  // since it has its own region code, "IM", which may be undesirable.