code: def update_labels(self, node_name: str, labels: dict):
          
          # Raise an exception if we are not a manager
          if not self._manager:
              raise RuntimeError('Only the Swarm manager node can update '
                                 'node details.')
  
          # Node specification
          node_spec = {'Availability': 'active',
                       'Name': node_name,
                       'Role': 'manager',
                       'Labels': labels}
          node = self._client.nodes.get(node_name)
          node.update(node_spec)
docs: Update label of a node.
  
          Args:
              node_name (string): Name of the node.
              labels (dict): Label to add to the node