def addChild(self, name=None, attrs={}, payload=[], namespace=None, node=None):
        """ If "node" argument is provided, adds it as child node. Else creates new node from
            the other arguments' values and adds it as well."""
        if 'xmlns' in attrs:
            raise AttributeError("Use namespace=x instead of attrs={'xmlns':x}")
        if node:
            newnode=node
            node.parent = self
        else: newnode=Node(tag=name, parent=self, attrs=attrs, payload=payload)
        if namespace:
            newnode.setNamespace(namespace)
        self.kids.append(newnode)
        self.data.append(u'')
        return newnode
 If "node" argument is provided, adds it as child node. Else creates new node from
            the other arguments' values and adds it as well.
chrome-cordova/gcmServer/xmpp/simplexml.py