def METHOD_NAME(
    ip: str, ports_to_scan: Collection[NetworkPort], timeout: float = DEFAULT_TIMEOUT
) -> Tuple[float, Dict[NetworkPort, str]]:
    """
    Checks whether any of the given ports are open on a target IP.
    :param ip:  IP of host to attack
    :param ports_to_scan: An iterable of ports to scan. Must not be empty.
    :param timeout: Amount of time to wait for connection
    """
    event_timestamp = time()
    open_ports: Dict[NetworkPort, str] = {}
    try:
        ports_sockets = _create_sockets(ports_to_scan)
        possible_ports, connected_ports_sockets = _connect_sockets(ip, ports_sockets)
        logger.debug(
            "Connecting to the following ports %s" % ",".join((str(x) for x in ports_to_scan))
        )
        if possible_ports:
            timer = EggTimer()
            timer.set(timeout)
            _process_connected_sockets(connected_ports_sockets, possible_ports, open_ports, timer)
        logger.info(
            f"Discovered the following ports on {ip}: "
            f"{pformat([port for port, _ in connected_ports_sockets])}"
        )
    except socket.error as exc:
        logger.warning("Exception when checking ports on host %s, Exception: %s", str(ip), exc)
    _clean_up_sockets(possible_ports, connected_ports_sockets)
    return event_timestamp, open_ports