Finding Duplicate Tags

Forgive my Monday brain.
Occasionally when copy/pasting tags for our rooms and spaces, we seem to accidentally create multiple tags of the same room in the same view (image 1).
I’m trying to write a script that pulls out all the room tags in a view and deletes any duplicates because we don’t understand why Revit is pasting multiple room or space tags for the same location.
Unfortunately, I can’t get these lists to compare (image 2). I’d tried a python script for loop to compare the two and it keeps returning Null.
Help me overcome Monday brain?

Do you only tag one plan? If you have tags of the same room on multiple plans then you’ll have to filter the duplicates per view, otherwise you can just use GroupByKey to group by associated room. Then use something like Deconstruct to separate the first tag of each room from any remaining. The excess tags then of course get deleted.

Yep, I will eventually have to get to the point where I filter out in every view, but in the meantime just trying it out with this sample, one-story, one view.

When I do a GroupByKey I’m not getting the result we’re looking for tho:

You want to group the tag elements by the associated room name. This will return a list representing each room and the tags associated with that room.

When applying this to room tags across multiple views, you’ll have to also group by the tag’s owner view. It’s just another grouping to give you tags by room by sheet.

I actually found a non-Dynamo means of solving this problem.

Turns out the problem was dependent views. When I pasted the space tags in all views, it included these dependent views as well. Then the tags would shine through to the parent view, giving overlapping tags on top of each other.
As long as I don’t tag the dependent views, or hide them on the parent views, I should be ok.
Thanks for you input @Nick_Boyts , I’ll keep exploring this in the future.