#NEWLINE# def process_spider_output( self , response , result , spider ) : #NEWLINE# #INDENT# def _set_referer( r ) : #NEWLINE# #INDENT# if isinstance ( r , Request ) : #NEWLINE# #INDENT# r . headers . setdefault ( 'Referer' , response . url ) #NEWLINE# #UNINDENT# return r #NEWLINE# #UNINDENT# return ( _set_referer ( self ) for r in ( result or ( ) ) )