<s> """<STR_LIT>""" <EOL> import collections <EOL> import collections . abc <EOL> class StrKeyDict ( collections . UserDict ) : <EOL> def __init__ ( self , args , normalize = str , ** kwargs ) : <EOL> super ( ) . __init__ ( self , * args , ** kwargs ) <EOL> self . normalize = normalize <EOL> def __missing__ ( self , key ) : <EOL> if self . normalize ( key ) == key : <EOL> raise KeyError ( key ) <EOL> return self [ self . normalize ( key ) ] <EOL> def __contains__ ( self , key ) : <EOL> return self . normalize ( key ) in self . data <EOL> def __setitem__ ( self , key , item ) : <EOL> self . data [ self . normalize ( key ) ] = item <EOL> def update ( self , iterable = None , ** kwds ) : <EOL> if iterable is not None : <EOL> if isinstance ( iterable , collections . abc . Mapping ) : <EOL> pairs = iterable . items ( ) <EOL> else : <EOL> pairs = ( ( k , v ) for k , v in iterable ) <EOL> for key , value in pairs : <EOL> self [ key ] = value <EOL> if kwds : <EOL> self . update ( kwds ) </s>
