def _build_national_number_for_parsing(number):
 index_of_phone_context = number.find(_RFC3966_PHONE_CONTEXT)
 if (index_of_phone_context > 0):
  phone_context_start = (index_of_phone_context + len(_RFC3966_PHONE_CONTEXT))
  if (number[phone_context_start] == _PLUS_SIGN):
   phone_context_end = number.find(U_SEMICOLON, phone_context_start)
   if (phone_context_end > 0):
    national_number = number[phone_context_start:phone_context_end]
   else:
    national_number = number[phone_context_start:]
  else:
   national_number = U_EMPTY_STRING
  index_of_rfc3996_prefix = number.find(_RFC3966_PREFIX)
  index_of_national_number = ((index_of_rfc3996_prefix + len(_RFC3966_PREFIX)) if (index_of_rfc3996_prefix >= 0) else 0)
  national_number += number[index_of_national_number:index_of_phone_context]
 else:
  national_number = _extract_possible_number(number)
 index_of_isdn = national_number.find(_RFC3966_ISDN_SUBADDRESS)
 if (index_of_isdn > 0):
  national_number = national_number[:index_of_isdn]
 return national_number

def _build_national_number_for_parsing ( number ) : index_of_phone_context = number . find ( _RFC3966_PHONE_CONTEXT ) if ( index_of_phone_context > 0 ) : phone_context_start = ( index_of_phone_context + len ( _RFC3966_PHONE_CONTEXT ) ) if ( number [ phone_context_start ] == _PLUS_SIGN ) : phone_context_end = number . find ( U_SEMICOLON , phone_context_start ) if ( phone_context_end > 0 ) : national_number = number [ phone_context_start : phone_context_end ] else : national_number = number [ phone_context_start : ] else : national_number = U_EMPTY_STRING index_of_rfc3996_prefix = number . find ( _RFC3966_PREFIX ) index_of_national_number = ( ( index_of_rfc3996_prefix + len ( _RFC3966_PREFIX ) ) if ( index_of_rfc3996_prefix >= 0 ) else 0 ) national_number += number [ index_of_national_number : index_of_phone_context ] else : national_number = _extract_possible_number ( number ) index_of_isdn = national_number . find ( _RFC3966_ISDN_SUBADDRESS ) if ( index_of_isdn > 0 ) : national_number = national_number [ : index_of_isdn ] return national_number
converts number to a form that we can parse and return it if it is written in rfc3966; otherwise extract a possible number out of it and return it .