def METHOD_NAME(self, val, real_to_fake_dict):
    replacements = list(real_to_fake_dict.keys())
    # if we have 'val1' and 'val10', we want 'val10' to be replaced first
    replacements.sort(reverse=True)
    for real_val in replacements:
        if real_val:
            fake_val = real_to_fake_dict[real_val]
            if real_val != fake_val:
                if isinstance(val, bytes):
                    val = val.replace(real_val.encode(), fake_val.encode())
                else:
                    val = val.replace(real_val, fake_val)
    return val