code: def cython_inline(
      code,
      get_type=unsafe_type,
      lib_dir=os.path.join(get_cython_cache_dir(), "inline"),
      cython_include_dirs=None,
      cython_compiler_directives=None,
      force=False,
      quiet=False,
      locals=None,
      globals=None,
      language_level=None,
      **kwds,
  ):
      if get_type is None:
          get_type = lambda x: "object"
      ctx = (
          _create_context(tuple(cython_include_dirs))
          if cython_include_dirs
          else _cython_inline_default_context
      )
  
      cython_compiler_directives = (
          dict(cython_compiler_directives)
          if cython_compiler_directives
          else {}
      )
      if (
          language_level is None
          and "language_level" not in cython_compiler_directives
      ):
          language_level = "3str"
      if language_level is not None:
          cython_compiler_directives["language_level"] = language_level
  
      # Fast path if this has been called in this session.
      _unbound_symbols = _cython_inline_cache.get(code)
      if _unbound_symbols is not None:
          _populate_unbound(kwds, _unbound_symbols, locals, globals)
          args = sorted(kwds.items())
          arg_sigs = tuple(
              [(get_type(value, ctx), arg) for arg, value in args]
          )
          key_hash = _inline_key(code, arg_sigs, language_level)
          invoke = _cython_inline_cache.get((code, arg_sigs, key_hash))
          if invoke is not None:
              arg_list = [arg[1] for arg in args]
              return invoke(*arg_list)
  
      orig_code = code
      code = to_unicode(code)
      code, literals = strip_string_literals(code)
      code = strip_common_indent(code)
      if locals is None:
          locals = inspect.currentframe().f_back.f_back.f_locals
      if globals is None:
          globals = inspect.currentframe().f_back.f_back.f_globals
      try:
          _cython_inline_cache[
              orig_code
          ] = _unbound_symbols = unbound_symbols(code)
          _populate_unbound(kwds, _unbound_symbols, locals, globals)
      except AssertionError:
          if not quiet:
              # Parsing from strings not fully supported (e.g. cimports).
              print(
                  "Could not parse code as a string (to extract unbound symbols)."
              )
  
      cimports = []
      for name, arg in list(kwds.items()):
          if arg is cython_module:
              cimports.append("\ncimport cython as %s" % name)
              del kwds[name]
      arg_names = sorted(kwds)
      arg_sigs = tuple(
          [(get_type(kwds[arg], ctx), arg) for arg in arg_names]
      )
      key_hash = _inline_key(orig_code, arg_sigs, language_level)
      module_name = "_cython_inline_" + key_hash
  
      if module_name in sys.modules:
          module = sys.modules[module_name]
  
      else:
          build_extension = None
          if cython_inline.so_ext is None:
              # Figure out and cache current extension suffix
              build_extension = _get_build_extension()
              cython_inline.so_ext = build_extension.get_ext_filename(
                  ""
              )
  
          module_path = os.path.join(
              lib_dir, module_name + cython_inline.so_ext
          )
  
          if not os.path.exists(lib_dir):
              os.makedirs(lib_dir)
          if force or not os.path.isfile(module_path):
              cflags = []
              c_include_dirs = []
              qualified = re.compile(r"([.\w]+)[.]")
              for type, _ in arg_sigs:
                  m = qualified.match(type)
                  if m:
                      cimports.append("\ncimport %s" % m.groups()[0])
                      # one special case
                      if m.groups()[0] == "numpy":
                          import numpy
  
                          c_include_dirs.append(numpy.get_include())
                          # cflags.append('-Wno-unused')
              module_body, func_body = extract_func_code(code)
              params = ", ".join(["%s %s" % a for a in arg_sigs])
              module_code = """
  %(module_body)s
  %(cimports)s
  def __invoke(%(params)s):
  %(func_body)s
      return locals()
              """ % {
                  "cimports": "\n".join(cimports),
                  "module_body": module_body,
                  "params": params,
                  "func_body": func_body,
              }
              for key, value in literals.items():
                  module_code = module_code.replace(key, value)
              pyx_file = os.path.join(lib_dir, module_name + ".pyx")
              fh = open(pyx_file, "w")
              try:
                  fh.write(module_code)
              finally:
                  fh.close()
              extension = Extension(
                  name=module_name,
                  sources=[pyx_file],
                  include_dirs=c_include_dirs,
                  extra_compile_args=cflags,
              )
              if build_extension is None:
                  build_extension = _get_build_extension()
              build_extension.extensions = cythonize(
                  [extension],
                  include_path=cython_include_dirs or ["."],
                  compiler_directives=cython_compiler_directives,
                  quiet=quiet,
              )
              build_extension.build_temp = os.path.dirname(pyx_file)
              build_extension.build_lib = lib_dir
              build_extension.run()
  
          module = load_dynamic(module_name, module_path)
  
      _cython_inline_cache[
          orig_code, arg_sigs, key_hash
      ] = module.__invoke
      arg_list = [kwds[arg] for arg in arg_names]
      return module.__invoke(*arg_list)
  
imports: from __future__ import absolute_import
  import hashlib
  import inspect
  import os
  import re
  import sys
  from distutils.core import Distribution, Extension
  from distutils.command.build_ext import build_ext
  import Cython
  from ..Compiler.Main import Context, default_options
  from ..Compiler.Visitor import CythonTransform, EnvTransform
  from ..Compiler.ParseTreeTransforms import SkipDeclarations
  from ..Compiler.TreeFragment import parse_from_strings
  from ..Compiler.StringEncoding import _unicode
  from .Dependencies import strip_string_literals, cythonize, cached_function
  from ..Compiler import Pipeline
  from ..Utils import get_cython_cache_dir
  import cython
label_desc: Use image node_id 8 for calling a global function with example usage: cython_inline(code, get_type, lib_dir, cython_include_dirs, cython_compiler_directives, force, quiet, locals, globals, language_level) and returns: module, invoke