code: def move_nodes_constrained(self, partition, constrained_partition, consider_comms=None):
      
      if (consider_comms is None):
        consider_comms = self.refine_consider_comms
      diff =  _c_leiden._Optimiser_move_nodes_constrained(self._optimiser, partition._partition, constrained_partition._partition, consider_comms)
      partition._update_internal_membership()
      return diff
docs: Move nodes to alternative communities for *refining* the partition.
  
      Parameters
      ----------
      partition
        The partition for which to move nodes.
  
      constrained_partition
        The partition within which we may move nodes.
  
      consider_comms
        If ``None`` uses :attr:`refine_consider_comms`, but can be set
        to something else.
  
      Returns
      -------
      float
        Improvement in quality function.
  
      Notes
      -----
      The idea is constrain the movement of nodes to alternative communities to
      another partition. In other words, if there is a partition ``P`` which we
      want to refine, we can then initialize a new singleton partition, and move
      nodes in that partition constrained to ``P``.
  
      See Also
      --------
      :func:`Optimiser.move_nodes`
  
      :func:`Optimiser.merge_nodes_constrained`
  
      Examples
      --------
      >>> G = ig.Graph.Famous('Zachary')
      >>> optimiser = la.Optimiser()
      >>> partition = la.ModularityVertexPartition(G)
      >>> diff = optimiser.optimise_partition(partition)
      >>> refine_partition = la.ModularityVertexPartition(G)
      >>> diff = optimiser.move_nodes_constrained(refine_partition, partition)