

def length_of_national_destination_code(numobj):
    'Return length of the national destination code code for a number.\n\n    Gets the length of the national destination code (NDC) from the\n    PhoneNumber object passed in, so that clients could use it to split a\n    national significant number into NDC and subscriber number. The NDC of a\n    phone number is normally the first group of digit(s) right after the\n    country calling code when the number is formatted in the international\n    format, if there is a subscriber number part that follows. An example of\n    how this could be used:\n\n    >>> import phonenumbers\n    >>> numobj = phonenumbers.parse("18002530000", "US")\n    >>> nsn = phonenumbers.national_significant_number(numobj)\n    >>> ndc_len = phonenumbers.length_of_national_destination_code(numobj)\n    >>> if ndc_len > 0:\n    ...     national_destination_code = nsn[:ndc_len]\n    ...     subscriber_number = nsn[ndc_len:]\n    ... else:\n    ...     national_destination_code = ""\n    ...     subscriber_number = nsn\n\n    Refer to the unittests to see the difference between this function and\n    length_of_geographical_area_code.\n\n    Arguments:\n    numobj -- The PhoneNumber object to find the length of the NDC from.\n\n    Returns the length of NDC of the PhoneNumber object passed in.\n    '
    if (numobj.extension is not None):
        copied_numobj = PhoneNumber()
        copied_numobj.merge_from(numobj)
        copied_numobj.extension = None
    else:
        copied_numobj = numobj
    nsn = format_number(copied_numobj, PhoneNumberFormat.INTERNATIONAL)
    number_groups = re.split(NON_DIGITS_PATTERN, nsn)
    if (len(nsn) <= 3):
        return 0
    if (number_type(numobj) == PhoneNumberType.MOBILE):
        mobile_token = country_mobile_token(numobj.country_code)
        if (mobile_token != U_EMPTY_STRING):
            return (len(number_groups[2]) + len(number_groups[3]))
    return len(number_groups[2])

dataset/ETHPy150Open daviddrysdale/python-phonenumbers/python/phonenumbers/phonenumberutil.py length_of_national_destination_code/VarMisuse@79/613 `number_groups`->`nsn`