code: def find():
      """Find a local spark installation.
  
      Will first check the SPARK_HOME env variable, and otherwise
      search common installation locations, e.g. from homebrew
      """
      spark_home = os.environ.get("SPARK_HOME", None)
  
      if not spark_home:
          if "pyspark" in sys.modules:
              return os.path.dirname(sys.modules["pyspark"].__file__)
          for path in [
              "/usr/local/opt/apache-spark/libexec",  # macOS Homebrew
              "/usr/lib/spark/",  # AWS Amazon EMR
              "/usr/local/spark/",  # common linux path for spark
              "/opt/spark/",  # other common linux path for spark
              # Any other common places to look?
          ]:
              if os.path.exists(path):
                  spark_home = path
                  break
  
      if not spark_home:
          # last resort: try importing pyspark (pip-installed, already on sys.path)
          try:
              import pyspark
          except ImportError:
              pass
          else:
              spark_home = os.path.dirname(pyspark.__file__)
  
      if not spark_home:
          raise ValueError(
              "Couldn't find Spark, make sure SPARK_HOME env is set"
              " or Spark is in an expected location (e.g. from homebrew installation)."
          )
  
      return spark_home
  
file_path: findspark/findspark.py
imports: from glob import glob
  import os
  import sys
label_desc: Use image node_id 1 for calling a global function with example usage: find() and returns: spark_home, os