#NEWLINE# def _generate_filename( self , start_date , election_type , result ) : #NEWLINE# #INDENT# if ( result [ 'district' ] == '' ) : #NEWLINE# #INDENT# office = result [ 'office' ] . lower ( ) . replace ( ' ' , '_' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# office = ( ( result [ 'office' ] . lower ( ) . replace ( ' ' , '_' ) + '__' ) + result [ 'district' ] ) #NEWLINE# #UNINDENT# if result [ 'special' ] : #NEWLINE# #INDENT# election_type = ( 'special__' + election_type ) #NEWLINE# #UNINDENT# bits = [ start_date . replace ( '-' , '' ) , self . state . lower ( ) , election_type , office ] #NEWLINE# if ( office == '' ) : #NEWLINE# #INDENT# bits . remove ( office ) #NEWLINE# #UNINDENT# name = ( '__' . join ( bits ) + '.csv' ) #NEWLINE# return name