<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def build_linestring_node(line, with_depth=False):
 """ Parses a line to a Node class :param line: Line as instance of :class:`openquake.hazardlib.geo.line.Line` :param bool with_depth: Include the depth values (True) or not (False):
 :returns: Instance of :class:`openquake.baselib.node.Node` """

    geom = []
    for p in line.points:
        if with_depth:
            geom.extend((p.x, p.y, p.z))
        else:
            geom.extend((p.x, p.y))
    poslist_node = Node("gml:posList", text=geom)
    return Node("gml:LineString", nodes=[poslist_node])