So, the problem was hard to condense into the title but here's a detailed explanation.
I have a large dictionary that has thousands of key-value pairs that could have the example below:
dict = {'apple' : ['mint', 'nutmeg', 'cinnamon'], 'mint' : ['apple', 'orange', 'banana']}
Notice how the 'apple' is a key and it has the list as its value, and the list contains the 'mint' element.
Somewhere in my large dictionary 'mint' could also be a key and it could have a list of fruits that has the element 'apple'. As it's the keys in the second element of the dictionary.
The issue is I want to keep the pair of apple and mint, no matter which one is the key or not, but I want a refined dictionary where they're not forming duplicates.
So the desired dictionary is either:
dict_2 = {'apple' : ['mint', 'nutmeg', 'cinnamon'], 'mint' : ['orange', 'banana']}
where the 'apple' element from the list of 'mint' has been removed,
or
dict_2 = {'apple' : ['nutmeg', 'cinnamon'], 'mint' : ['apple', 'orange', 'banana']}
where the 'mint' element from the list of 'apple' has been removed.
EDIT: I've found the solution to this problem. You can find it below