<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def purge_collection(keys):
    "Recursive purge of nodes with name and id"
    for key in keys:
        m = re.match(r'(.*) \((\d+)\)', key)
        name = m.group(1)
        node_id = m.group(2)
        value = render_value_for_node(node_id)
        print 'remove node with name:{0} and id:{1}'.format(name, node_id)

        delete_node(node_id=node_id)
        if isinstance(value, dict):
            purge_collection(value.keys())