def _create_graph(
    response_jsons: Iterable[dict[str, Any]],
    bidirectional: bool,  # noqa: FBT001
) -> nx.MultiDiGraph:
    """
    Create a NetworkX MultiDiGraph from Overpass API responses.

    Adds length attributes in meters (great-circle distance between endpoints)
    to all of the graph's (pre-simplified, straight-line) edges via the
    `distance.add_edge_lengths` function.

    Parameters
    ----------
    response_jsons
        Iterable of JSON responses from the Overpass API.
    bidirectional
        If True, create bidirectional edges for one-way streets.

    Returns
    -------
    G
        The resulting MultiDiGraph.
    """
    # each dict's keys are OSM IDs and values are dicts of attributes
    nodes: dict[int, dict[str, Any]] = {}
    paths: dict[int, dict[str, Any]] = {}

    # consume response_jsons generator to download data from server. if
    # cache_only_mode, just consume response_jsons then continue next loop.
    # otherwise, extract nodes and paths from the downloaded OSM data.
    response_count = 0
    for response_json in response_jsons:
        response_count += 1
        if not settings.cache_only_mode:
            nodes_temp, paths_temp = _parse_nodes_paths(response_json)
            nodes.update(nodes_temp)
            paths.update(paths_temp)

    msg = f"Retrieved all data from API in {response_count} request(s)"
    utils.log(msg, level=lg.INFO)
    if settings.cache_only_mode:  # pragma: no cover
        # after consuming all response_jsons in loop, raise exception to catch
        msg = "Interrupted because `settings.cache_only_mode=True`."
        raise CacheOnlyInterruptError(msg)

    # ensure we got some node/way data back from the server request(s)
    if (len(nodes) == 0) and (len(paths) == 0):  # pragma: no cover
        msg = "No data elements in server response. Check query location/filters and log."
        raise InsufficientResponseError(msg)

    # create the MultiDiGraph and set its graph-level attributes
    metadata = {
        "created_date": utils.ts(),
        "created_with": f"OSMnx {metadata_version('osmnx')}",
        "crs": settings.default_crs,
    }
    G = nx.MultiDiGraph(**metadata)

    # add each OSM node and way (a path of edges) to the graph
    msg = f"Creating graph from {len(nodes):,} OSM nodes and {len(paths):,} OSM ways..."
    utils.log(msg, level=lg.INFO)
    G.add_nodes_from(nodes.items())
    _add_paths(G, paths.values(), bidirectional)

    msg = f"Created graph with {len(G):,} nodes and {len(G.edges):,} edges"
    utils.log(msg, level=lg.INFO)

    # add length (great-circle distance between nodes) attribute to each edge
    if len(G.edges) > 0:
        G = distance.add_edge_lengths(G)

    return G

    Create a NetworkX MultiDiGraph from Overpass API responses.

    Adds length attributes in meters (great-circle distance between endpoints)
    to all of the graph's (pre-simplified, straight-line) edges via the
    `distance.add_edge_lengths` function.

    Parameters
    ----------
    response_jsons
        Iterable of JSON responses from the Overpass API.
    bidirectional
        If True, create bidirectional edges for one-way streets.

    Returns
    -------
    G
        The resulting MultiDiGraph.
    
osmnx/graph.py