docs: def update_node(node, flush=True, **kwargs):
      """
      Update a node.
      If new attributes are present, they will be added to the node.
      The non-presence of attributes does not remove them.
  
      The flush argument indicates whether dbsession.flush should be called. THis
      is set to False when update_node is called from another function which does
      the flush.
  
      """
      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))
  
      node_i.network.check_write_permission(user_id)
  
      node_i.name = node.name if node.name is not None else node_i.name
      node_i.x    = node.x if node.x is not None else node_i.x
      node_i.y    = node.y if node.y is not None else node_i.y
      node_i.description = node.description if node.description is not None else node_i.description
      node_i.layout      = node.get_layout() if node.layout is not None else node_i.layout
  
      if node.attributes is not None:
          _update_attributes(node_i, node.attributes)
  
      if node.types is not None:
          hdb.add_resource_types(node_i, node.types)
  
      if flush is True:
          db.DBSession.flush()
  
      return node_i