def find_path(graph, start, end=0, limit=None):
    """Get a path through the routing network,
    from a segment to an outlet.

    Parameters
    ----------
    graph : dict
        Dictionary of seg : outseg numbers
    start : int
        Starting segment
    end : int
        Ending segment (default 0)
    limit : int
        Option to limit the length of the path returned.
        By default, None (path is traced to the end routing number).

    Returns
    -------
    path : list
        List of segment numbers along routing path.
    """
    if limit is None:
        limit = len(graph)
    path = [start]
    next = start
    for i in range(limit):
        next = graph[next]
        path.append(next)
        if next == end:
            break
    return path