def _maybe_strip_extension(number):
 match = _EXTN_PATTERN.search(number)
 if (match and _is_viable_phone_number(number[:match.start()])):
  for group in match.groups():
   if (group is not None):
    return (group, number[:match.start()])
 return ('', number)

def _maybe_strip_extension ( number ) : match = _EXTN_PATTERN . search ( number ) if ( match and _is_viable_phone_number ( number [ : match . start ( ) ] ) ) : for group in match . groups ( ) : if ( group is not None ) : return ( group , number [ : match . start ( ) ] ) return ( '' , number )
strip extension from the end of a number string .