#NEWLINE# def __getitem__( self , key ) : #NEWLINE# #INDENT# if ( key in self ) : #NEWLINE# #INDENT# return dict . __getitem__ ( self , key ) #NEWLINE# #UNINDENT# key += self . sep #NEWLINE# result = record ( ) #NEWLINE# for ( k , v ) in self . iteritems ( ) : #NEWLINE# #INDENT# if ( not k . startswith ( key ) ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# suffix = k [ len ( key ) : ] #NEWLINE# if ( '.' in suffix ) : #NEWLINE# #INDENT# ks = suffix . split ( self . sep ) #NEWLINE# z = result #NEWLINE# for x in ks [ : ( - 1 ) ] : #NEWLINE# #INDENT# if ( x not in z ) : #NEWLINE# #INDENT# z [ x ] = record ( ) #NEWLINE# #UNINDENT# z = z [ x ] #NEWLINE# #UNINDENT# z [ ks [ ( - 1 ) ] ] = v #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# result [ suffix ] = v #NEWLINE# #UNINDENT# #UNINDENT# if ( len ( x ) == 0 ) : #NEWLINE# #INDENT# raise KeyError ( ( 'No key or prefix: %s' % key ) ) #NEWLINE# #UNINDENT# return result