docs: def update_link(link,**kwargs):
      """
          Update a link.
      """
      user_id = kwargs.get('user_id')
      #check_perm(user_id, 'edit_topology')
      try:
          link_i = db.DBSession.query(Link).filter(Link.id == link.id).one()
          link_i.network.check_write_permission(user_id)
      except NoResultFound:
          raise ResourceNotFoundError("Link %s not found"%(link.id))
  
      #Each of thiese should be updateable independently
      if link.name is not None:
          link_i.name = link.name
      if link.node_1_id is not None:
          link_i.node_1_id = link.node_1_id
      if link.node_2_id is not None:
          link_i.node_2_id = link.node_2_id
      if link.description is not None:
          link_i.description = link.description
      if link.layout is not None:
          link_i.layout  = link.get_layout()
      if link.attributes is not None:
          hdb.add_resource_attributes(link_i, link.attributes)
      if link.types is not None:
          hdb.add_resource_types(link_i, link.types)
  
      db.DBSession.flush()
      return link_i