def description_for_valid_number(numobj, lang, script=None, region=None):
 number_region = region_code_for_number(numobj)
 if ((region is None) or (region == number_region)):
  mobile_token = country_mobile_token(numobj.country_code)
  national_number = national_significant_number(numobj)
  if ((mobile_token != U_EMPTY_STRING) and national_number.startswith(mobile_token)):
   national_number = national_number[len(mobile_token):]
   region = region_code_for_country_code(numobj.country_code)
   try:
    copied_numobj = parse(national_number, region)
   except NumberParseException:
    copied_numobj = numobj
   area_description = _prefix_description_for_number(GEOCODE_DATA, GEOCODE_LONGEST_PREFIX, copied_numobj, lang, script, region)
  else:
   area_description = _prefix_description_for_number(GEOCODE_DATA, GEOCODE_LONGEST_PREFIX, numobj, lang, script, region)
  if (area_description != ''):
   return area_description
  else:
   return country_name_for_number(numobj, lang, script, region)
 else:
  return _region_display_name(number_region, lang, script, region)

def description_for_valid_number ( numobj , lang , script = None , region = None ) : number_region = region_code_for_number ( numobj ) if ( ( region is None ) or ( region == number_region ) ) : mobile_token = country_mobile_token ( numobj . country_code ) national_number = national_significant_number ( numobj ) if ( ( mobile_token != U_EMPTY_STRING ) and national_number . startswith ( mobile_token ) ) : national_number = national_number [ len ( mobile_token ) : ] region = region_code_for_country_code ( numobj . country_code ) try : copied_numobj = parse ( national_number , region ) except NumberParseException : copied_numobj = numobj area_description = _prefix_description_for_number ( GEOCODE_DATA , GEOCODE_LONGEST_PREFIX , copied_numobj , lang , script , region ) else : area_description = _prefix_description_for_number ( GEOCODE_DATA , GEOCODE_LONGEST_PREFIX , numobj , lang , script , region ) if ( area_description != '' ) : return area_description else : return country_name_for_number ( numobj , lang , script , region ) else : return _region_display_name ( number_region , lang , script , region )
return a text description of a phonenumber object .