def orientation_entropy(
    G: nx.MultiGraph | nx.MultiDiGraph,
    *,
    num_bins: int = 36,
    min_length: float = 0,
    weight: str | None = None,
) -> float:
    """
    Calculate graph's orientation entropy.

    Orientation entropy is the Shannon entropy of the graphs' edges' bearings
    across evenly spaced bins. Ignores self-loop edges as their bearings are
    undefined. If `G` is a MultiGraph, all edge bearings will be bidirectional
    (ie, two reciprocal bearings per undirected edge). If `G` is a
    MultiDiGraph, all edge bearings will be directional (ie, one bearing per
    directed edge).

    For more info see: Boeing, G. 2019. "Urban Spatial Order: Street Network
    Orientation, Configuration, and Entropy." Applied Network Science, 4 (1),
    67. https://doi.org/10.1007/s41109-019-0189-1

    Parameters
    ----------
    G
        Unprojected graph with `bearing` attributes on each edge.
    num_bins
        Number of bins. For example, if `num_bins=36` is provided, then each
        bin will represent 10 degrees around the compass.
    min_length
        Ignore edges with "length" attributes less than `min_length`. Useful
        to ignore the noise of many very short edges.
    weight
        If None, apply equal weight for each bearing. Otherwise, weight edges'
        bearings by this (non-null) edge attribute. For example, if "length"
        is provided, each edge's bearing observation will be weighted by its
        "length" attribute value.

    Returns
    -------
    entropy
        The orientation entropy of `G`.
    """
    # check if we were able to import scipy
    if scipy is None:  # pragma: no cover
        msg = "scipy must be installed as an optional dependency to calculate entropy."
        raise ImportError(msg)
    bin_counts, _ = _bearings_distribution(G, num_bins, min_length, weight)
    entropy: float = scipy.stats.entropy(bin_counts)
    return entropy

    Calculate graph's orientation entropy.

    Orientation entropy is the Shannon entropy of the graphs' edges' bearings
    across evenly spaced bins. Ignores self-loop edges as their bearings are
    undefined. If `G` is a MultiGraph, all edge bearings will be bidirectional
    (ie, two reciprocal bearings per undirected edge). If `G` is a
    MultiDiGraph, all edge bearings will be directional (ie, one bearing per
    directed edge).

    For more info see: Boeing, G. 2019. "Urban Spatial Order: Street Network
    Orientation, Configuration, and Entropy." Applied Network Science, 4 (1),
    67. https://doi.org/10.1007/s41109-019-0189-1

    Parameters
    ----------
    G
        Unprojected graph with `bearing` attributes on each edge.
    num_bins
        Number of bins. For example, if `num_bins=36` is provided, then each
        bin will represent 10 degrees around the compass.
    min_length
        Ignore edges with "length" attributes less than `min_length`. Useful
        to ignore the noise of many very short edges.
    weight
        If None, apply equal weight for each bearing. Otherwise, weight edges'
        bearings by this (non-null) edge attribute. For example, if "length"
        is provided, each edge's bearing observation will be weighted by its
        "length" attribute value.

    Returns
    -------
    entropy
        The orientation entropy of `G`.
    
osmnx/bearing.py