This is bit funny code as you can first read from this excellent response: http://www.daniweb.com/software-development/python/threads/427341/custom-types-in-a-simple-way#post1828718 why should you not use it, even it maybe feels useful.
Anyway I got curious to see how type signature could be implemented, even using it would generally just be stupid way of slowing down your code. But like mountain climbers tell about why they climb the mountain: "Because it is there". So here this un-Pythonic do not trust user as responsible adult code is. Maybe those hasattrs could have been try...except, but as it is unpythonic any case, who cares...
Also using recursion for type check would probably make lot of sense and clean code. It would make sense to make type check a function and use it both for key and the value, now key can be only be checked against single type.
Edited by pyTony