human
Give me a the Python code you requested given the following:
Complete the below
def _node_func(G):

    ''''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.'
    '''
assistant
#Here is the Python code you requested.
    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