code: def calculate_partition_movement(prev_assignment, curr_assignment):
      
      total_movements = 0
      movements = {}
      for prev_partition, prev_replicas in six.iteritems(prev_assignment):
          curr_replicas = curr_assignment[prev_partition]
          diff = len(set(curr_replicas) - set(prev_replicas))
          if diff:
              total_movements += diff
              movements[prev_partition] = (
                  (set(prev_replicas) - set(curr_replicas)),
                  (set(curr_replicas) - set(prev_replicas)),
              )
      return movements, total_movements
docs: Calculate the partition movements from initial to current assignment.
      Algorithm:
          For each partition in initial assignment
              # If replica set different in current assignment:
                  # Get Difference in sets
      :rtype: tuple
      dict((partition,  (from_broker_set, to_broker_set)), total_movements