Insert the parsed element (``name``, ``value`` pair) into the node.

        You should always use the returned node and forget the one
        that was given in parameter.

        :param node: the node where the is added to
        :returns: the node. Note that this may be a new node instance.

def _element_to_node(self, node, name, value):
        """ Insert the parsed element (``name``, ``value`` pair) into the node.

        You should always use the returned node and forget the one
        that was given in parameter.

        :param node: the node where the is added to
        :returns: the node. Note that this may be a new node instance.
        """

        # is the target node a list?
        try:
            node.append(value)
        except AttributeError:
            pass
        else:
            return node

        # target node is a dict
        if name in node:
            # there's already an element with same name -> convert the node into list
            node = node.values() + [value]
        else:
            # just add the value into the node
            node[name] = value
        return node