<s> def _singleton ( klass ) : <EOL> """<STR_LIT>""" <EOL> if not klass . _instance : <EOL> klass . _instance = klass ( ) <EOL> return klass . _instance <EOL> class Configurator ( object ) : <EOL> """<STR_LIT>""" <EOL> _instance = None <EOL> def __call__ ( self ) : <EOL> """<STR_LIT>""" <EOL> if not self . _instance : <EOL> self . _instance = self ( ) <EOL> return self . _instance <EOL> def __init__ ( self ) : <EOL> self . __dict__ [ '<STR_LIT>' ] = { } <EOL> def __getattr__ ( self , k ) : <EOL> """<STR_LIT>""" <EOL> if hasattr ( self . _config , k ) : <EOL> return getattr ( self . _config , k ) <EOL> else : <EOL> return self . __dict__ [ k ] <EOL> def __setattr__ ( self , k , v ) : <EOL> """<STR_LIT>""" <EOL> if hasattr ( self . _config , k ) : <EOL> setattr ( self . _config , k , v ) <EOL> else : <EOL> self . __dict__ [ k ] = v <EOL> def __getitem__ ( self , k ) : <EOL> """<STR_LIT>""" <EOL> return self . _config [ k ] <EOL> def __setitem__ ( self , k , v ) : <EOL> """<STR_LIT>""" <EOL> self . _config [ k ] = v <EOL> Configurator = _singleton ( Configurator ) </s>
