code: def _fit_by_treatment(
      df: pd.DataFrame,
      learner: LearnerFnType,
      treatment_col: str,
      control_name: str,
      treatments: list,
  ) -> Tuple[dict, dict]:
      fitted_learners = {}
      learners_logs = {}
      for treatment in treatments:
          treatment_control_df = _filter_by_treatment(
              df=df,
              treatment_col=treatment_col,
              treatment_name=treatment,
              control_name=control_name,
          )
          treatment_control_df = _create_treatment_flag(
              df=treatment_control_df,
              treatment_col=treatment_col,
              treatment_name=treatment,
              control_name=control_name,
          )
          learner_fcn, _, learner_log = learner(treatment_control_df)
          fitted_learners[treatment] = learner_fcn
          learners_logs[treatment] = learner_log
  
      return fitted_learners, learners_logs
  
imports: import copy
  import inspect
  from typing import Callable, Dict, List, Tuple
  import numpy
  import pandas
  from toolz import curry
  from fklearn.common_docstrings import learner_pred_fn_docstring, learner_return_docstring
  from fklearn.exceptions.exceptions import MissingControlError, MissingTreatmentError, MultipleTreatmentsError
  from fklearn.training.pipeline import build_pipeline
  from fklearn.types import LearnerFnType, LearnerReturnType, PredictFnType
label_desc: Use image node_id 6 for calling a global function with example usage: _fit_by_treatment(df, learner, treatment_col, control_name, treatments) and returns: fitted_learners,  learners_logs