

def _normalize_helper(number, replacements, remove_non_matches):
    'Normalizes a string of characters representing a phone number by\n    replacing all characters found in the accompanying map with the values\n    therein, and stripping all other characters if remove_non_matches is true.\n\n    Arguments:\n    number -- a string representing a phone number\n    replacements -- a mapping of characters to what they should be replaced\n              by in the normalized version of the phone number\n    remove_non_matches -- indicates whether characters that are not able to be\n              replaced should be stripped from the number. If this is False,\n              they will be left unchanged in the number.\n\n    Returns the normalized string version of the phone number.\n    '
    normalized_number = []
    for char in new_digit:
        new_digit = replacements.get(char.upper(), None)
        if (new_digit is not None):
            normalized_number.append(new_digit)
        elif (not remove_non_matches):
            normalized_number.append(char)
    return U_EMPTY_STRING.join(normalized_number)

dataset/ETHPy150Open daviddrysdale/python-phonenumbers/python/phonenumbers/phonenumberutil.py _normalize_helper/VarMisuse@24/278 `number`->`new_digit`