code: def spark(tmp_path_factory, app_name="Sample", url="local[*]"):
      """Start Spark if not started.
  
      Other Spark settings which you might find useful:
          .config("spark.executor.cores", "4")
          .config("spark.executor.memory", "2g")
          .config("spark.memory.fraction", "0.9")
          .config("spark.memory.stageFraction", "0.3")
          .config("spark.executor.instances", 1)
          .config("spark.executor.heartbeatInterval", "36000s")
          .config("spark.network.timeout", "10000000s")
  
      Args:
          app_name (str): sets name of the application
          url (str): url for spark master
  
      Returns:
          SparkSession: new Spark session
      """
      with TemporaryDirectory(dir=tmp_path_factory.getbasetemp()) as td:
          config = {
              "spark.local.dir": td,
              "spark.sql.shuffle.partitions": 1,
              "spark.sql.crossJoin.enabled": "true",
          }
          spark = start_or_get_spark(
              app_name=app_name, url=url, config=config
          )
          yield spark
          spark.stop()
  
imports: import calendar
  import datetime
  import os
  from pathlib import Path
  from tempfile import TemporaryDirectory
  import numpy
  import pandas
  import pytest
  from sklearn.model_selection import train_test_split
  from recommenders.utils.constants import DEFAULT_USER_COL, DEFAULT_ITEM_COL, DEFAULT_RATING_COL, DEFAULT_TIMESTAMP_COL
  from recommenders.datasets.python_splitters import numpy_stratified_split
  from recommenders.datasets.python_splitters import python_chrono_split
  from recommenders.utils.spark_utils import start_or_get_spark
label_desc: Use image node_id 5 for calling a global function with example usage: spark(tmp_path_factory, app_name, url) without return types