human
Complete this python program:
def _node_func(G):
assistant
#Here is the Python program you requested.

    """Returns a function which returns a sorted node for line graphs.
    When constructing a line graph for undirected graphs, we must normalize
    the ordering of nodes as they appear in the edge.
    """
    if G.is_multigraph():
        def sorted_node(u, v, key):
            return ((u, v, key) if (u <= v) else (v, u, key))
    else:
        def sorted_node(u, v):
            return ((u, v) if (u <= v) else (v, u))
    return sorted_node