code: def add_child(self, **kwargs):
          
          cls = get_result_class(self.__class__)
  
          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:
              newobj = cls(**kwargs)
  
          try:
              newobj._cached_depth = self._cached_depth + 1
          except AttributeError:
              pass
          if not cls.node_order_by:
              try:
                  max = cls.objects.filter(parent=self).reverse(
                  )[0].sib_order
              except IndexError:
                  max = 0
              newobj.sib_order = max + 1
          newobj.parent = self
          newobj.save()
          return newobj
docs: Adds a child to the node.