code: def init(spark_home=None, python_path=None, edit_rc=False, edit_profile=False):
      
  
      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
  
      if not os.environ.get("PYSPARK_SUBMIT_ARGS", None):
          os.environ["PYSPARK_SUBMIT_ARGS"] = ''
  
      # add pyspark to sys.path
      spark_python = os.path.join(spark_home, 'python')
      py4j = glob(os.path.join(spark_python, 'lib', 'py4j-*.zip'))[0]
      sys.path[:0] = [spark_python, py4j]
  
      if edit_rc:
          change_rc(spark_home, spark_python, py4j)
  
      if edit_profile:
          edit_ipython_profile(spark_home, spark_python, py4j)
docs: 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.