def expected_cost_for_region(short_number, region_dialing_from):
 if isinstance(short_number, PhoneNumber):
  short_number = national_significant_number(short_number)
 metadata = PhoneMetadata.short_metadata_for_region(region_dialing_from)
 if (metadata is None):
  return ShortNumberCost.UNKNOWN_COST
 if _is_number_matching_desc(short_number, metadata.premium_rate):
  return ShortNumberCost.PREMIUM_RATE
 if _is_number_matching_desc(short_number, metadata.standard_rate):
  return ShortNumberCost.STANDARD_RATE
 if _is_number_matching_desc(short_number, metadata.toll_free):
  return ShortNumberCost.TOLL_FREE
 if is_emergency_number(short_number, region_dialing_from):
  return ShortNumberCost.TOLL_FREE
 return ShortNumberCost.UNKNOWN_COST

def expected_cost_for_region ( short_number , region_dialing_from ) : if isinstance ( short_number , PhoneNumber ) : short_number = national_significant_number ( short_number ) metadata = PhoneMetadata . short_metadata_for_region ( region_dialing_from ) if ( metadata is None ) : return ShortNumberCost . UNKNOWN_COST if _is_number_matching_desc ( short_number , metadata . premium_rate ) : return ShortNumberCost . PREMIUM_RATE if _is_number_matching_desc ( short_number , metadata . standard_rate ) : return ShortNumberCost . STANDARD_RATE if _is_number_matching_desc ( short_number , metadata . toll_free ) : return ShortNumberCost . TOLL_FREE if is_emergency_number ( short_number , region_dialing_from ) : return ShortNumberCost . TOLL_FREE return ShortNumberCost . UNKNOWN_COST
gets the expected cost category of a short number when dialled from a region .