<s> """<STR_LIT>""" <EOL> from django import template <EOL> register = template . Library ( ) <EOL> @ register . filter <EOL> def getattr ( obj , args ) : <EOL> """<STR_LIT>""" <EOL> try : <EOL> args = args . split ( '<STR_LIT:U+002C>' ) <EOL> except AttributeError : <EOL> raise AttributeError ( ( '<STR_LIT>' <EOL> '<STR_LIT>' ) % ( args , obj ) ) <EOL> if len ( args ) == <NUM_LIT:1> : <EOL> ( attribute , default ) = [ args [ <NUM_LIT:0> ] , '<STR_LIT>' ] <EOL> else : <EOL> ( attribute , default ) = args <EOL> try : <EOL> return obj . __getattribute__ ( attribute ) <EOL> except AttributeError : <EOL> return obj . __dict__ . get ( attribute , default ) <EOL> except : <EOL> return default </s>
