def get_source_name(parent):
    """Yield source name once you find it.
    
    The source name is found by travelling the graph backwards
    until we find the output socket of a regular node or of an
    orphan redirect node.

    Parameters
    ==========

    parent (an output socket)
        socket containing data needed to determine the source
        name to use; it is called "parent" because it is further
        up in the socket parenthood tree.
    """
    ### if the parent node has 'source_name' in its data, it means
    ### the previous node is a redirect node with a parent, so
    ### we look further backwards

    if 'source_name' in parent.node.data:
        yield from get_source_name(parent.node.proxy_socket.parent)

    ### otherwise, we just use the output name of the output socket found,
    ### regardless of whether it is an orphan redirect node or another
    ### kind of node
    else:
        yield parent.output_name
Yield source name once you find it.
    
    The source name is found by travelling the graph backwards
    until we find the output socket of a regular node or of an
    orphan redirect node.

    Parameters
    ==========

    parent (an output socket)
        socket containing data needed to determine the source
        name to use; it is called "parent" because it is further
        up in the socket parenthood tree.
    
nodezator/graphman/proxynode/segment.py