#NEWLINE# def get_root_node( cur ) : #NEWLINE# #INDENT# "\n    Return root node. Raise ``ValueError`` if root node doesn't exist.\n    " #NEWLINE# sql = '\n        SELECT\n          *\n        FROM\n          nodes\n        WHERE\n          parent IS NULL;\n    ' #NEWLINE# cur . execute ( sql ) #NEWLINE# result = cur . fetchone ( ) #NEWLINE# if ( result is None ) : #NEWLINE# #INDENT# raise ValueError ( 'No root node.' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return NodeData ( ** result )