def save_summaries(frames, keys, selected_summaries, batch_dir, batch_name):
    """Writes the summaries to csv-files

    Args:
        frames: list of ``cellpy`` summary DataFrames
        keys: list of indexes (typically run-names) for the different runs
        selected_summaries: list defining which summary data to save
        batch_dir: directory to save to
        batch_name: the batch name (will be used for making the file-name(s))

    Returns: a pandas DataFrame with your selected summaries.

    """
    if not frames:
        logger.info("Could save summaries - no summaries to save!")
        logger.info("You have no frames - aborting")
        return None
    if not keys:
        logger.info("Could save summaries - no summaries to save!")
        logger.info("You have no keys - aborting")
        return None

    selected_summaries_dict = create_selected_summaries_dict(selected_summaries)
    summary_df = pd.concat(frames, keys=keys, axis=1)
    # saving the selected summaries
    for key, value in selected_summaries_dict.items():
        _summary_file_name = os.path.join(batch_dir, "summary_%s_%s.csv" % (
        key, batch_name))
        _summary_df = summary_df.iloc[:,
                      summary_df.columns.get_level_values(1) == value]
        # include function to tweak headers here (need to learn MultiIndex)
        _header = _summary_df.columns
        _summary_df.to_csv(_summary_file_name, sep=";")
        logger.info(
            "saved summary (%s) to:\n       %s" % (key, _summary_file_name))
    logger.info("finished saving summaries")
    return summary_df
Writes the summaries to csv-files

    Args:
        frames: list of ``cellpy`` summary DataFrames
        keys: list of indexes (typically run-names) for the different runs
        selected_summaries: list defining which summary data to save
        batch_dir: directory to save to
        batch_name: the batch name (will be used for making the file-name(s))

    Returns: a pandas DataFrame with your selected summaries.