'Clone the node. This is defined as a shallow copy, except for member lists
amongst the child attributes (from get_child_accessors) which are also
copied. Lists containing child nodes are thus seen as a way for the node
to hold multiple children directly; the list is not treated as a separate
level in the tree.'

def clone_node(self):

    result = copy.copy(self)
    for attrname in result.child_attrs:
        value = getattr(result, attrname)
        if isinstance(value, list):
            setattr(result, attrname, [x for x in value])
    return result
