code: def plan_to_assignment(plan):
      
      assignment = {}
      for elem in plan['partitions']:
          assignment[
              (elem['topic'], elem['partition'])
          ] = elem['replicas']
      return assignment
docs: Convert the plan to the format used by cluster-topology.