def _convert_path(element: dict[str, Any]) -> dict[str, Any]:
    """
    Convert an OSM way element into the format for a NetworkX path.

    Parameters
    ----------
    element
        OSM element of type "way".

    Returns
    -------
    path
        The converted path.
    """
    path = {"osmid": element["id"]}

    # remove any consecutive duplicate elements in the list of nodes
    path["nodes"] = [group[0] for group in groupby(element["nodes"])]

    if "tags" in element:
        for useful_tag in settings.useful_tags_way:
            if useful_tag in element["tags"]:
                path[useful_tag] = element["tags"][useful_tag]
    return path

    Convert an OSM way element into the format for a NetworkX path.

    Parameters
    ----------
    element
        OSM element of type "way".

    Returns
    -------
    path
        The converted path.
    
osmnx/graph.py