code: def test_predict_correctly_handles_save_modes(
      tmp_recipe_root_path: Path,
      predict_step_output_dir: Path,
      spark_session,
      using: str,
      save_mode: str,
  ):
      rm_name = "model_" + get_random_id()
      model_uri = train_log_and_register_model(rm_name, is_dummy=True)
      # We create a dataframe with the same schema as the expected output dataframe to avoid schema
      # incompatibility during overwrite.
      sdf = spark_session.createDataFrame(
          [
              (0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0),
          ],
          [
              "age",
              "sex",
              "bmi",
              "bp",
              "s1",
              "s2",
              "s3",
              "s4",
              "s5",
              "s6",
              "prediction",
          ],
      )
      if using == "table":
          output_path = "table_" + get_random_id()
          sdf.write.format("delta").saveAsTable(output_path)
      else:
          output_file = f"output_{get_random_id()}.{using}"
          output_path = str(predict_step_output_dir / output_file)
          sdf.coalesce(1).write.format(using).save(output_path)
  
      recipe_config = read_yaml(
          tmp_recipe_root_path, _RECIPE_CONFIG_FILE_NAME
      )
      recipe_config.update(
          {
              "steps": {
                  "predict": {
                      "output": {
                          "using": using,
                          "location": output_path,
                      },
                      "model_uri": model_uri,
                      "save_mode": save_mode,
                  },
              },
          }
      )
  
      predict_step = PredictStep.from_recipe_config(
          recipe_config, str(tmp_recipe_root_path)
      )
      if save_mode == "overwrite":
          predict_step.run(str(predict_step_output_dir))
      else:
          with pytest.raises(
              MlflowException, match="already populated"
          ):
              predict_step.run(str(predict_step_output_dir))
  
imports: import os
  import tempfile
  from pathlib import Path
  from unittest import mock
  import pandas
  import pytest
  from pyspark.sql import SparkSession
  from sklearn.datasets import load_diabetes
  import mlflow
  from mlflow.exceptions import MlflowException
  from mlflow.recipes.artifacts import RegisteredModelVersionInfo
  from mlflow.recipes.steps.predict import _INPUT_FILE_NAME, _SCORED_OUTPUT_FILE_NAME, PredictStep
  from mlflow.recipes.steps.register import _REGISTERED_MV_INFO_FILE
  from mlflow.recipes.utils import _RECIPE_CONFIG_FILE_NAME
  from mlflow.utils.file_utils import read_yaml
  from tests.recipes.helper_functions import get_random_id, train_and_log_model, train_log_and_register_model
label_desc: Use image node_id 10 for calling a global function with example usage: test_predict_correctly_handles_save_modes(tmp_recipe_root_path, predict_step_output_dir, spark_session, using, save_mode) without return types