def hasher():
    return collections.defaultdict(hasher)
hash = hasher()
hash['element1']['sub1']['subsub1'] = 'value1'
if 'subsub1' in hash['element1']['sub1']:
    pass
In a dict of dicts, how do you emulate Perl's auto-vivification behavior?