def circuity_avg(Gu: nx.MultiGraph) -> float | None:
    """
    Calculate average street circuity using edges of undirected graph.

    Circuity is the sum of edge lengths divided by the sum of straight-line
    distances between edge endpoints. Calculates straight-line distance as
    euclidean distance if projected or great-circle distance if unprojected.
    Returns None if the edge lengths sum to zero.

    Parameters
    ----------
    Gu
        Undirected input graph.

    Returns
    -------
    circuity_avg
        The graph's average undirected edge circuity.
    """
    if nx.is_directed(Gu):  # pragma: no cover
        msg = "`Gu` must be undirected."
        raise ValueError(msg)

    # extract the edges' endpoint nodes' coordinates
    n = Gu.nodes
    coords = np.array([(n[u]["y"], n[u]["x"], n[v]["y"], n[v]["x"]) for u, v, _ in Gu.edges])
    y1 = coords[:, 0]
    x1 = coords[:, 1]
    y2 = coords[:, 2]
    x2 = coords[:, 3]

    # calculate straight-line distances as euclidean distances if projected or
    # great-circle distances if unprojected
    if projection.is_projected(Gu.graph["crs"]):
        sl_dists = distance.euclidean(y1=y1, x1=x1, y2=y2, x2=x2)
    else:
        sl_dists = distance.great_circle(lat1=y1, lon1=x1, lat2=y2, lon2=x2)

    # return the ratio, handling possible division by zero
    sl_dists_total = sl_dists[~np.isnan(sl_dists)].sum()
    try:
        return float(edge_length_total(Gu) / sl_dists_total)
    except ZeroDivisionError:
        return None

    Calculate average street circuity using edges of undirected graph.

    Circuity is the sum of edge lengths divided by the sum of straight-line
    distances between edge endpoints. Calculates straight-line distance as
    euclidean distance if projected or great-circle distance if unprojected.
    Returns None if the edge lengths sum to zero.

    Parameters
    ----------
    Gu
        Undirected input graph.

    Returns
    -------
    circuity_avg
        The graph's average undirected edge circuity.
    
osmnx/stats.py