code: public Set<Integer> getUsedPorts(SupervisorDetails supervisor) {
          Map<String, SchedulerAssignment> assignments = this.getAssignments();
          Set<Integer> usedPorts = new HashSet<>();
  
          for (SchedulerAssignment assignment : assignments.values()) {
              for (WorkerSlot slot : assignment.getExecutorToSlot().values()) {
                  if (slot.getNodeId().equals(supervisor.getId())) {
                      usedPorts.add(slot.getPort());
                  }
              }
          }
  
          return usedPorts;
      }
docs: Get all the used ports of this supervisor.