human
Complete the below
def eliminate_rhs_duplicates(expr_list_list, ref_node_sequence):

    ''''Replace rhs items by LetRefNodes if they appear more than once.
    Creates a sequence of LetRefNodes that set up the required temps
    and appends them to ref_node_sequence.  The input list is modified
    in-place.'
    '''

Write me a the Python code you requested?
assistant
#Here is the Python code you requested.
    seen_nodes = set()
    ref_nodes = {}
    def find_duplicates(node):
        if (node.is_literal or node.is_name):
            return
        if (node in seen_nodes):
            if (node not in ref_nodes):
                ref_node = LetRefNode(node)
                ref_nodes[node] = ref_node
                ref_node_sequence.append(ref_node)
        else:
            seen_nodes.add(node)
            if node.is_sequence_constructor:
                for item in node.args:
                    find_duplicates(item)
    for expr_list in expr_list_list:
        rhs = expr_list[(-1)]
        find_duplicates(rhs)
    if (not ref_nodes):
        return
    def substitute_nodes(node):
        if (node in ref_nodes):
            return ref_nodes[node]
        elif node.is_sequence_constructor:
            node.args = list(map(substitute_nodes, node.args))
        return node
    for node in ref_nodes:
        if node.is_sequence_constructor:
            node.args = list(map(substitute_nodes, node.args))
    for expr_list in expr_list_list:
        expr_list[(-1)] = substitute_nodes(expr_list[(-1)])