code: def has_fortran():
      if not hasattr(has_fortran, "result"):
          try:
              (stdout, stderr), info = compile_run_strings(
                  [
                      (
                          "main.f90",
                          (
                              "program foo\n"
                              'print *, "hello world"\n'
                              "end program"
                          ),
                      )
                  ],
                  clean=True,
              )
          except CompilerNotFoundError:
              has_fortran.result = False
              if (
                  os.environ.get("SYMPY_STRICT_COMPILER_CHECKS", "0")
                  == "1"
              ):
                  raise
          else:
              if (
                  info["exit_status"] != os.EX_OK
                  or "hello world" not in stdout
              ):
                  if (
                      os.environ.get(
                          "SYMPY_STRICT_COMPILER_CHECKS", "0"
                      )
                      == "1"
                  ):
                      raise ValueError(
                          "Failed to compile test program:\n%s\n%s\n"
                          % (stdout, stderr)
                      )
                  has_fortran.result = False
              else:
                  has_fortran.result = True
      return has_fortran.result
  
imports: import os
  from .compilation import compile_run_strings
  from .util import CompilerNotFoundError
label_desc: Use image node_id 1 for calling a global function with example usage: has_fortran() and returns: has_fortran