code: def init(
      spark_home=None,
      python_path=None,
      edit_rc=False,
      edit_profile=False,
  ):
      """Make pyspark importable.
  
      Sets environment variables and adds dependencies to sys.path.
      If no Spark location is provided, will try to find an installation.
  
      Parameters
      ----------
      spark_home : str, optional, default = None
          Path to Spark installation, will try to find automatically
          if not provided.
      python_path : str, optional, default = None
          Path to Python for Spark workers (PYSPARK_PYTHON),
          will use the currently running Python if not provided.
      edit_rc : bool, optional, default = False
          Whether to attempt to persist changes by appending to shell
          config.
      edit_profile : bool, optional, default = False
          Whether to create an IPython startup file to automatically
          configure and import pyspark.
      """
  
      if not spark_home:
          spark_home = find()
  
      if not python_path:
          python_path = os.environ.get("PYSPARK_PYTHON", sys.executable)
  
      # ensure SPARK_HOME is defined
      os.environ["SPARK_HOME"] = spark_home
  
      # ensure PYSPARK_PYTHON is defined
      os.environ["PYSPARK_PYTHON"] = python_path
  
      # add pyspark to sys.path
  
      if "pyspark" not in sys.modules:
          spark_python = os.path.join(spark_home, "python")
          try:
              py4j = glob(
                  os.path.join(spark_python, "lib", "py4j-*.zip")
              )[0]
          except IndexError:
              raise Exception(
                  "Unable to find py4j in {}, your SPARK_HOME may not be configured correctly".format(
                      spark_python
                  )
              )
          sys.path[:0] = sys_path = [spark_python, py4j]
      else:
          # already imported, no need to patch sys.path
          sys_path = None
  
      if edit_rc:
          _edit_rc(spark_home, sys_path)
  
      if edit_profile:
          _edit_ipython_profile(spark_home, sys_path)
  
file_path: findspark/findspark.py
imports: from glob import glob
  import os
  import sys
label_desc: Use image node_id 4 for calling a global function with example usage: init(spark_home, python_path, edit_rc, edit_profile) without return types