code: def add_child(self, **kwargs):
          
          if not self.is_leaf():
              # there are child nodes, delegate insertion to add_sibling
              if self.node_order_by:
                  pos = 'sorted-sibling'
              else:
                  pos = 'last-sibling'
              last_child = self.get_last_child()
              last_child._cached_parent_obj = self
              return last_child.add_sibling(pos, **kwargs)
  
          # we're adding the first child of this node
          sql, params = self.__class__._move_right(self.tree_id,
                                                   self.rgt, False, 2)
  
          if len(kwargs) == 1 and 'instance' in kwargs:
              # adding the passed (unsaved) instance to the tree
              newobj = kwargs['instance']
              if newobj.pk:
                  raise NodeAlreadySaved("Attempted to add a tree node that is "\
                      "already in the database")
          else:
              # creating a new object
              newobj = get_result_class(self.__class__)(**kwargs)
  
          newobj.tree_id = self.tree_id
          newobj.depth = self.depth + 1
          newobj.lft = self.lft + 1
          newobj.rgt = self.lft + 2
  
          # this is just to update the cache
          self.rgt += 2
  
          newobj._cached_parent_obj = self
  
          cursor = self._get_database_cursor('write')
          cursor.execute(sql, params)
  
          # saving the instance before returning it
          newobj.save()
  
          return newobj
docs: Adds a child to the node.