#NEWLINE# def substitute( self , subs ) : #NEWLINE# #INDENT# if ( not self . is_variable ( ) ) : #NEWLINE# #INDENT# return self #NEWLINE# #UNINDENT# for ( var , restrs ) in subs : #NEWLINE# #INDENT# if ( self == '_' ) : #NEWLINE# #INDENT# return Direction ( self . _dir , restrs ) #NEWLINE# #UNINDENT# #UNINDENT# return self