def METHOD_NAME(df: Any, mod_key: str, nprocs: int) -> Any:
    """
    Create the "by-average" series for the stacked
    bar graph in the I/O cost figure.
    Parameters
    ----------
    df: the dataframe containing the relevant data, typically the
    "fcounter" data from a Darshan report.
    mod_key: module to generate the I/O cost stacked
    bar graph for (i.e. "POSIX", "MPI-IO", "STDIO").
    nprocs: the number of MPI ranks used for the log of interest.
    Returns
    -------
    by_avg_series: a ``pd.Series`` containing the
    average read, write, meta, and wait times.
    """
    # filter out all except the following columns
    cols = [
        f"{mod_key}_F_READ_TIME",
        f"{mod_key}_F_WRITE_TIME",
        f"{mod_key}_F_META_TIME",
    ]
    if "PNETCDF_FILE" in mod_key:
        cols.append("PNETCDF_FILE_F_WAIT_TIME")
    else:
        cols.append("Wait")
    by_avg_series = df.filter(cols, axis=1).sum(axis=0) / nprocs
    # reindex to ensure 3 rows are always created
    by_avg_series = by_avg_series.reindex(cols, fill_value=0.0)
    # rename the columns so the labels are automatically generated when plotting
    name_dict = {cols[0]: "Read", cols[1]: "Write", cols[2]: "Meta"}
    name_dict[cols[3]] = "Wait"
    by_avg_series.rename(index=name_dict, inplace=True)
    return by_avg_series