code: async def update(
          self, *, node_id: str, version: int, spec: Mapping[str, Any]
      ) -> Mapping[str, Any]:
          
  
          params = {"version": version}
  
          if "Role" in spec:
              assert spec["Role"] in {"worker", "manager"}
  
          if "Availability" in spec:
              assert spec["Availability"] in {"active", "pause", "drain"}
  
          response = await self.docker._query_json(
              "nodes/{node_id}/update".format(node_id=node_id),
              method="POST",
              params=params,
              data=spec,
          )
          return response
docs: Update the spec of a node.
  
          Args:
              node_id: The ID or name of the node
              version: version number of the node being updated
              spec: fields to be updated