def _add_nodes_xml(
    parent: Element,
    gdf_nodes: gpd.GeoDataFrame,
) -> None:
    """
    Add graph nodes as subelements of an XML parent element.

    Parameters
    ----------
    parent
        The XML parent element.
    gdf_nodes
        A GeoDataFrame of graph nodes.
    """
    node_tags = set(settings.useful_tags_node)
    node_attrs = {"id", "lat", "lon"}.union(ATTR_DEFAULTS)

    # add each node attrs dict as a SubElement of parent
    for node in gdf_nodes.to_dict(orient="records"):
        attrs = {k: str(node[k]) for k in node_attrs if pd.notna(node[k])}
        node_element = SubElement(parent, "node", attrib=attrs)

        # add each node tag dict as its own SubElement of the node SubElement
        # for vals that are non-null (or list if node consolidation was done)
        tags = (
            {"k": k, "v": str(node[k])}
            for k in node_tags & node.keys()
            if isinstance(node[k], list) or pd.notna(node[k])
        )
        for tag in tags:
            _ = SubElement(node_element, "tag", attrib=tag)

    Add graph nodes as subelements of an XML parent element.

    Parameters
    ----------
    parent
        The XML parent element.
    gdf_nodes
        A GeoDataFrame of graph nodes.
    
osmnx/_osm_xml.py