docs: def delete_node(node_id, purge_data,**kwargs):
      """
          Remove node from DB completely
          If there are attributes on the node, use purge_data to try to
          delete the data. If no other resources link to this data, it
          will be deleted.
  
      """
      user_id = kwargs.get('user_id')
      try:
          node_i = db.DBSession.query(Node).filter(Node.id == node_id).one()
      except NoResultFound:
          raise ResourceNotFoundError("Node %s not found"%(node_id))
  
      group_items = db.DBSession.query(ResourceGroupItem).filter(
                                          ResourceGroupItem.node_id==node_id).all()
      for gi in group_items:
          db.DBSession.delete(gi)
  
      if purge_data == 'Y':
          _purge_datasets_unique_to_resource('NODE', node_id)
  
      log.info("Deleting node %s, id=%s", node_i.name, node_id)
  
      node_i.network.check_write_permission(user_id)
      db.DBSession.delete(node_i)
      db.DBSession.flush()
      return 'OK'