#NEWLINE# def _tgrep_nltk_tree_pos_action( _s , _l , tokens ) : #NEWLINE# #INDENT# '\n    Builds a lambda function representing a predicate on a tree node\n    which returns true if the node is located at a specific tree\n    position.\n    ' #NEWLINE# node_tree_position = tuple ( ( int ( x ) for x in tokens if x . isdigit ( ) ) ) #NEWLINE# return ( lambda i : ( lambda n , m = None , l = None : ( hasattr ( n , 'treeposition' ) and ( n . treeposition ( ) == i ) ) ) ) ( _l )