code: def _edit_rc(spark_home, sys_path=None):
      """Persists changes to environment by changing shell config.
  
      Adds lines to .bashrc to set environment variables
      including the adding of dependencies to the system path. Will only
      edit this file if they already exist. Currently only works for bash.
  
      Parameters
      ----------
      spark_home : str
          Path to Spark installation.
      sys_path: list(str)
          Paths (if any) to be added to $PYTHONPATH.
          Should include python subdirectory of Spark installation, py4j
      """
  
      bashrc_location = os.path.expanduser("~/.bashrc")
  
      if os.path.isfile(bashrc_location):
          with open(bashrc_location, "a") as bashrc:
              bashrc.write("\n# Added by findspark\n")
              bashrc.write("export SPARK_HOME={}\n".format(spark_home))
              if sys_path:
                  bashrc.write(
                      "export PYTHONPATH={}\n".format(
                          os.pathsep.join(sys_path + ["$PYTHONPATH"])
                      )
                  )
              bashrc.write("\n")
  
file_path: findspark/findspark.py
imports: from glob import glob
  import os
  import sys
label_desc: Use image node_id 2 for calling a global function with example usage: _edit_rc(spark_home, sys_path) without return types