def remove_all(items, item_to_remove):
if not isinstance(items, list):
raise TypeError(f'invalid list type {type(items).__name__}')
last_occurrence = False
while not last_occurrence:
try:
items.remove(item_to_remove)
except ValueError:
last_occurrence = True