def _is_number_match_OO(numobj1_in, numobj2_in):
    # Make copies of the phone number so that the numbers passed in are not edited.
    numobj1 = PhoneNumber()
    numobj1.merge_from(numobj1_in)
    numobj2 = PhoneNumber()
    numobj2.merge_from(numobj2_in)
    # First clear raw_input, country_code_source and
    # preferred_domestic_carrier_code fields and any empty-string extensions
    # so that we can use the PhoneNumber equality method.
    numobj1.raw_input = None
    numobj1.country_code_source = None
    numobj1.preferred_domestic_carrier_code = None
    numobj2.raw_input = None
    numobj2.country_code_source = None
    numobj2.preferred_domestic_carrier_code = None
    if (numobj1.extension is not None and
        len(numobj1.extension) == 0):
        numobj1.extension = None
    if (numobj2.extension is not None and
        len(numobj2.extension) == 0):
        numobj2.extension = None

    # Early exit if both had extensions and these are different.
    if (numobj1.extension is not None and
        numobj2.extension is not None and
        numobj1.extension != numobj2.extension):
        return MatchType.NO_MATCH

    country_code1 = numobj1.country_code
    country_code2 = numobj2.country_code
    # Both had country_code specified.
    if country_code1 != 0 and country_code2 != 0:
        if numobj1 == numobj2:
            return MatchType.EXACT_MATCH
        elif (country_code1 == country_code2 and
              _is_national_number_suffix_of_other(numobj1, numobj2)):
            # A SHORT_NSN_MATCH occurs if there is a difference because of the
            # presence or absence of an 'Italian leading zero', the presence
            # or absence of an extension, or one NSN being a shorter variant
            # of the other.
            return MatchType.SHORT_NSN_MATCH
        # This is not a match.
        return MatchType.NO_MATCH

    # Checks cases where one or both country_code fields were not
    # specified. To make equality checks easier, we first set the country_code
    # fields to be equal.
    numobj1.country_code = country_code2
    # If all else was the same, then this is an NSN_MATCH.
    if numobj1 == numobj2:
        return MatchType.NSN_MATCH
    if _is_national_number_suffix_of_other(numobj1, numobj2):
        return MatchType.SHORT_NSN_MATCH
    return MatchType.NO_MATCH
Takes two phone number objects and compares them for equality.
dataset/ETHPy150Open daviddrysdale/python-phonenumbers/python/phonenumbers/phonenumberutil.py/_is_number_match_OO