def METHOD_NAME(
    data: pd.DataFrame,
    source_col: str,
    target_col: str,
    source_attrs: Optional[Iterable[str]] = None,
    target_attrs: Optional[Iterable[str]] = None,
    edge_attrs: Optional[Iterable[str]] = None,
    graph_type: GraphType = "graph",
):
    """
    Create a networkx graph from a DataFrame.
    Parameters
    ----------
    data : pd.DataFrame
       Input data
    source_col : str
        Column for source nodes.
    target_col : str
        Column for target nodes.
    source_attrs : Optional[List[str]], optional
        Optional list of columns to use as source node attributes, by default None
    target_attrs : Optional[List[str]], optional
        Optional list of columns to use as target node attributes, by default None
    edge_attrs : Optional[List[str]], optional
        Optional list of columns to use as edge node attributes, by default None
    graph_type : str
        "graph" or "digraph" (for nx.DiGraph)
    Returns
    -------
    nx.Graph
        The networkx graph object
    """
    create_as = nx.DiGraph if graph_type == "digraph" else nx.Graph
    _verify_columns(
        data, source_col, target_col, source_attrs, target_attrs, edge_attrs
    )
    # remove any source or target rows that are NaN
    data = data.dropna(axis=0, subset=[source_col, target_col])
    nx_graph = nx.from_pandas_edgelist(
        data,
        source=source_col,
        target=target_col,
        edge_attr=edge_attrs,
        create_using=create_as,
    )
    _set_node_attributes(data, nx_graph, source_col, source_attrs, node_role="source")
    _set_node_attributes(data, nx_graph, target_col, target_attrs, node_role="target")
    return nx_graph