def _convert_graph_attr_types(G: nx.MultiDiGraph, dtypes: dict[str, Any]) -> nx.MultiDiGraph:
    """
    Convert graph-level attributes using a dict of data types.

    Parameters
    ----------
    G
        Graph to convert the graph-level attributes of.
    dtypes
        Dict of graph-level attribute names:types.

    Returns
    -------
    G
        The graph with its graph-level attributes' types converted.
    """
    # remove node_default and edge_default metadata keys if they exist
    G.graph.pop("node_default", None)
    G.graph.pop("edge_default", None)

    for attr in G.graph.keys() & dtypes.keys():
        G.graph[attr] = dtypes[attr](G.graph[attr])

    return G

    Convert graph-level attributes using a dict of data types.

    Parameters
    ----------
    G
        Graph to convert the graph-level attributes of.
    dtypes
        Dict of graph-level attribute names:types.

    Returns
    -------
    G
        The graph with its graph-level attributes' types converted.
    
osmnx/io.py