<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def summary_engine(**kwargs):
 """engine to extract summary data"""

    logger.debug("summary_engine")
    # farms = kwargs["farms"]

    farms = []
    experiments = kwargs["experiments"]

    for experiment in experiments:
        if experiment.selected_summaries is None:
            selected_summaries = [
                "discharge_capacity", "charge_capacity",
                "coulombic_efficiency",
                "cumulated_coulombic_efficiency",
                "ir_discharge", "ir_charge",
                "end_voltage_discharge", "end_voltage_charge",
            ]
        else:
            selected_summaries = experiment.selected_summaries
        farm = helper.join_summaries(
            experiment.summary_frames,
            selected_summaries
        )
        farms.append(farm)
    barn = "batch_dir"

    return farms, barn