def _prep_edges(edges, nodes, from_col, to_col, x_col, y_col):
    """
    Prepare edges to display edges as lines on the plot

    Parameters
    ----------
    nodes : pandas.DataFrame
    edges : pandas.DataFrame
    from_col : string
        name of column to use for 'from' node id
    to_col : string
        name of column to use for 'to' node id
    x_col : string
        name of column to use for 'x' node coordinates
    y_col : string
        name of column to use for 'y' node coordinates

    Returns
    -------
    edges_wline : pandas.DataFrame
        the edge dataframe with from and to x y coordinates and
        ids to build lines
    """
    if x_col not in nodes.columns or y_col not in nodes.columns:
        raise ValueError('{} or {} columns were not found in nodes columns'
            .format(x_col, y_col))
    if from_col not in edges.columns or to_col not in edges.columns:
        raise ValueError('{} or {} columns were not found in edges columns'
            .format(from_col, to_col))
    edges_wline = edges.merge(nodes[[x_col, y_col]], left_on=from_col,
        right_index=True)
    edges_wline.rename(columns={x_col: 'from_lon', y_col: 'from_lat'},
        inplace=True)
    edges_wline = edges_wline.merge(nodes[[x_col, y_col]], left_on=to_col,
        right_index=True)
    edges_wline.rename(columns={x_col: 'to_lon', y_col: 'to_lat'}, inplace=True
        )
    return edges_wline
