code: def _filter_by_treatment(
      df: pd.DataFrame,
      treatment_col: str,
      treatment_name: str,
      control_name: str,
  ) -> pd.DataFrame:
      treatment_control_values = df[treatment_col].unique()
  
      if control_name not in treatment_control_values:
          raise MissingControlError()
  
      if treatment_name not in treatment_control_values:
          raise MissingTreatmentError()
  
      treatment_control_df = df.loc[
          (df[treatment_col] == treatment_name)
          | (df[treatment_col] == control_name),
          :,
      ]
      return treatment_control_df
  
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 4 for calling a global function with example usage: _filter_by_treatment(df, treatment_col, treatment_name, control_name) and returns: treatment_control_df