code: def get_or_create_backend(backend, num_proc, verbose, use_gpu):
      if backend is None:
          if num_proc is None:
              num_proc = _find_num_proc(use_gpu)
          backend = SparkBackend(
              num_proc,
              stdout=sys.stdout,
              stderr=sys.stderr,
              prefix_output_with_timestamp=True,
              verbose=verbose,
          )
      elif num_proc is not None:
          raise ValueError(
              'At most one of parameters "backend" and "num_proc" may be specified'
          )
      return backend
  
imports: import sys
  from functools import wraps
  from horovod.spark.common.backend import SparkBackend
  from pyspark.context import SparkContext
label_desc: Use image node_id 2 for calling a global function with example usage: get_or_create_backend(backend, num_proc, verbose, use_gpu) and returns: backend