#NEWLINE# def _prepare_pos_var( self , pos , method_name , valid_pos , valid_sorted_pos ) : #NEWLINE# #INDENT# if ( pos is None ) : #NEWLINE# #INDENT# if self . node_order_by : #NEWLINE# #INDENT# pos = 'sorted-sibling' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# pos = 'last-sibling' #NEWLINE# #UNINDENT# #UNINDENT# if ( pos not in valid_pos ) : #NEWLINE# #INDENT# raise InvalidPosition ( ( 'Invalid relative position: %s' % ( pos , ) ) ) #NEWLINE# #UNINDENT# if ( self . node_order_by and ( pos not in valid_sorted_pos ) ) : #NEWLINE# #INDENT# raise InvalidPosition ( ( 'Must use %s in %s when node_order_by is enabled' % ( ' or ' . join ( valid_sorted_pos ) , method_name ) ) ) #NEWLINE# #UNINDENT# if ( ( pos in valid_sorted_pos ) and ( not self . node_order_by ) ) : #NEWLINE# #INDENT# raise MissingNodeOrderBy ( 'Missing node_order_by attribute.' ) #NEWLINE# #UNINDENT# return pos