code: def _move_partition(self, state):
          
          partition = random.randint(0, len(self.cluster_topology.partitions) - 1)
  
          # Choose distinct source and destination brokers.
          source = random.choice(state.replicas[partition])
          dest = random.randint(0, len(self.cluster_topology.brokers) - 1)
          if dest in state.replicas[partition]:
              return None
          source_rg = state.broker_rg[source]
          dest_rg = state.broker_rg[dest]
  
          # Ensure replicas remain balanced across replication groups.
          if source_rg != dest_rg:
              source_rg_replicas = state.rg_replicas[source_rg][partition]
              dest_rg_replicas = state.rg_replicas[dest_rg][partition]
              if source_rg_replicas <= dest_rg_replicas:
                  return None
  
          # Ensure movement size capacity is not surpassed
          partition_size = state.partition_sizes[partition]
          if (self.args.max_movement_size is not None and
                  state.movement_size + partition_size >
                  self.args.max_movement_size):
              return None
  
          return state.move(partition, source, dest)
docs: Attempt to move a random partition to a random broker. If the
          chosen movement is not possible, None is returned.
  
          :param state: The starting state.
  
          :return: The resulting State object if a movement is found. None if
              no movement is found.