#NEWLINE# def apply_extra_context( extra_context , context ) : #NEWLINE# #INDENT# '\n    Adds items from extra_context dict to context.  If a value in extra_context\n    is callable, then it is called and the result is added to context.\n    ' #NEWLINE# for ( key , value ) in extra_context . iteritems ( ) : #NEWLINE# #INDENT# if callable ( value ) : #NEWLINE# #INDENT# context [ key ] = value ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# context [ key ] = value