def METHOD_NAME(
        chain: SupportedBlockchain,
        timeout: int = NODE_CONNECTION_TIMEOUT,
        node_names: Optional[Sequence[NodeName]] = None,
) -> DictNodeNameNodeAttributes:
    """Attempt to connect to either a default sequence of reliable nodes for
    testing (e.g. Parity ones) or to a custom ones (via `node_names` param).
    Finally return the available node attributes map.
    NB: prioritising nodes by block_number is disabled.
    """
    def attempt_connect_node(node: NodeName) -> tuple[NodeName, Optional[NodeNameAttributes]]:
        try:
            node_interface = SubstrateInterface(
                url=node.endpoint(),
                type_registry_preset='kusama',
                use_remote_preset=True,
            )
        except (requests.exceptions.RequestException, SubstrateRequestException) as e:
            message = (
                f'Substrate tests failed to connect to {node} node at '
                f'endpoint: {node.endpoint()}. Connection error: {e!s}.',
            )
            log.error(message)
            return node, None
        log.info(f'Substrate tests connected to {node} node at endpoint: {node_interface.url}.')
        node_attributes = NodeNameAttributes(
            node_interface=node_interface,
            weight_block=BlockNumber(0),
        )
        return node, node_attributes
    if chain == SupportedBlockchain.KUSAMA:
        node_names = node_names or KUSAMA_TEST_NODES
    else:
        raise AssertionError(f'Unexpected substrate chain type: {chain} at test')
    greenlets = [gevent.spawn(attempt_connect_node, node) for node in node_names]
    jobs = gevent.joinall(greenlets, timeout=timeout)
    # Populate available node attributes map
    available_node_attributes_map: DictNodeNameNodeAttributes = {}
    for job in jobs:
        node, node_attributes = job.value
        if node_attributes:
            available_node_attributes_map[node] = node_attributes
    connected_nodes = set(available_node_attributes_map.keys())
    not_connected_nodes = set(node_names) - connected_nodes
    if not_connected_nodes:
        log.info(
            f'Substrate {chain} tests failed to connect to nodes: '
            f'{",".join([str(node) for node in not_connected_nodes])} ',
        )
    return available_node_attributes_map