<s> def optimized ( fn ) : <EOL> """<STR_LIT>""" <EOL> def _optimized ( self , * args , ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> if self . optimizationEnabled : <EOL> class_name = self . __class__ . __name__ <EOL> module = self . __module__ . replace ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> try : <EOL> imported = __import__ ( "<STR_LIT>" % ( module , class_name ) , globals ( ) , locals ( ) , [ fn . __name__ ] ) <EOL> function = getattr ( imported , fn . __name__ ) <EOL> return function ( self , * args , ** kwargs ) <EOL> except ImportError : <EOL> print "<STR_LIT>" % ( fn . __name__ , self ) <EOL> return fn ( self , * args , ** kwargs ) <EOL> else : <EOL> return fn ( self , * args , ** kwargs ) <EOL> setattr ( _optimized , "<STR_LIT>" , fn . __name__ ) <EOL> setattr ( _optimized , "<STR_LIT>" , fn . __repr__ ) <EOL> setattr ( _optimized , "<STR_LIT>" , fn . __str__ ) <EOL> setattr ( _optimized , "<STR_LIT>" , fn . __doc__ ) <EOL> return _optimized </s>
