Your issue is that you have re-defined list
as a variable previously in your code. This means that when you do type(tmpDict[key])==list
if will return False
because they aren't equal.
That being said, you should instead use isinstance(tmpDict[key], list)
when testing the type of something, this won't avoid the problem of overwriting list
but is a more Pythonic way of checking the type.