Question: 
Write a function to remove tuple elements that occur more than once and replace the duplicates with some custom value.


Model's Code:
def remove_replica(tup):
    counts = {}
    for item in tup:
        if item in counts:
            counts[item] += 1
        else:
            counts[item] = 1
    return tuple('MSP' if counts[item] > 1 else item for item in tup)



Sample Correct Code:
def remove_replica(test_tup):
  temp = set()
  res = tuple(ele if ele not in temp and not temp.add(ele) 
				else 'MSP' for ele in test_tup)
  return (res)


Asserts:
assert remove_replica((1, 1, 4, 4, 4, 5, 5, 6, 7, 7)) == (1, 'MSP', 4, 'MSP', 'MSP', 5, 'MSP', 6, 7, 'MSP')
assert remove_replica((2, 3, 4, 4, 5, 6, 6, 7, 8, 9, 9)) == (2, 3, 4, 'MSP', 5, 6, 'MSP', 7, 8, 9, 'MSP')
assert remove_replica((2, 2, 5, 4, 5, 7, 5, 6, 7, 7)) == (2, 'MSP', 5, 4, 'MSP', 7, 'MSP', 6, 'MSP', 'MSP')


Tests:
Test 1 of 3: FAIL: AssertionError()

Test 376 of 974: 271/376 (72.07446808510637%): failed