code: def _select_designated_port(self, root_port):
          
          d_ports = []
          root_msg = root_port.designated_priority
  
          for port in self.ports.values():
              port_msg = port.designated_priority
              if (port.state is PORT_STATE_DISABLE
                      or port.ofport.port_no == root_port.ofport.port_no):
                  continue
              if (port_msg is None or
                      (port_msg.root_id.value != root_msg.root_id.value)):
                  d_ports.append(port.ofport.port_no)
              else:
                  result = Stp.compare_root_path(
                      root_msg.root_path_cost,
                      port_msg.root_path_cost - port.path_cost,
                      self.bridge_id.value,
                      port_msg.designated_bridge_id.value,
                      port.port_id.value,
                      port_msg.designated_port_id.value)
                  if result is SUPERIOR:
                      d_ports.append(port.ofport.port_no)
  
          return d_ports
docs: DESIGNATED_PORT is a port of the side near the root bridge
              of each link. It is determined by the cost of each path, etc
              same as ROOT_PORT.