code: def get_affected_stacked_overfitting_model_names(
      leaderboard: pd.DataFrame,
  ) -> Tuple[List[str], List[str]]:
      """
      Given a leaderboard from `predictor.leaderboard(test_data)`, return the names of all models that are affected by stacked overfitting and the names of all
      models that are not affected.
  
      Parameters
      ----------
      leaderboard : pd.DataFrame
          A leaderboard produced by `predictor.leaderboard(test_data)`.
          The leaderboard needs to contain `model` as column.
  
      Returns
      -------
      non_affected, List of str, names of all non-affected models in the leaderboard.
      affected, List of str, names of all affected models in the leaderboard.
      """
  
      non_affected = []
      affected = []
      stack_level = 2
      leaderboard_mapping = leaderboard.set_index("model")
      model_to_level_map = leaderboard_mapping["stack_level"].to_dict()
      for model_name in set(leaderboard["model"]):
          # TODO: move away from using names to metadata properties (somehow).
          #   - include something like linear models once we are sure that they cannot leak
          if (
              model_name.startswith("WeightedEnsemble")
              and model_to_level_map[model_name] <= stack_level
          ) or model_to_level_map[model_name] <= (stack_level - 1):
              non_affected.append(model_name)
          else:
              affected.append(model_name)
  
      return non_affected, affected
  
imports: import logging
  from typing import List, Tuple
  import pandas
label_desc: Use image node_id 1 for calling a global function with example usage: get_affected_stacked_overfitting_model_names(leaderboard) and returns: non_affected,  affected