def find_join(df, id, downstream_col="downstream", upstream_col="upstream"):
    """Find the joins for a given segment id in a joins table.

    Parameters
    ----------
    df : DataFrame
        data frame containing the joins
    id : any
        id to lookup in upstream or downstream columns
    downstream_col : str, optional (default "downstream")
        name of downstream column
    upstream_col : str, optional (default "upstream")
        name of upstream column

    Returns
    -------
    Joins that have the id as an upstream or downstream.
    """
    return df.loc[(df[upstream_col] == id) | (df[downstream_col] == id)]