code: def try_compile(compiler, code=None, flags=[], ext=None):
      """Returns True if the compiler is able to compile the given code"""
      from distutils.errors import CompileError
      from numpy.distutils.fcompiler import FCompiler
  
      if code is None:
          if isinstance(compiler, FCompiler):
              code = "      program main\n      return\n      end"
          else:
              code = "int main (int argc, char **argv) { return 0; }"
  
      ext = ext or compiler.src_extensions[0]
  
      with tempfile.TemporaryDirectory() as temp_dir:
          fname = os.path.join(temp_dir, "main" + ext)
          with open(fname, "w") as f:
              f.write(code)
  
          try:
              compiler.compile(
                  [fname], output_dir=temp_dir, extra_postargs=flags
              )
          except CompileError:
              return False
      return True
  
file_path: catboost/contrib/python/scipy/py3/scipy/_build_utils/compiler_helper.py
imports: import tempfile
  import os
  import sys
  from numpy.distutils.system_info import dict_append
label_desc: Use image node_id 1 for calling a global function with example usage: try_compile(compiler, code, flags, ext) and returns: True, False