code: def jit_user_function(
      func: Callable, nopython: bool, nogil: bool, parallel: bool
  ) -> Callable:
      """
      JIT the user's function given the configurable arguments.
  
      Parameters
      ----------
      func : function
          user defined function
      nopython : bool
          nopython parameter for numba.JIT
      nogil : bool
          nogil parameter for numba.JIT
      parallel : bool
          parallel parameter for numba.JIT
  
      Returns
      -------
      function
          Numba JITed function
      """
      if TYPE_CHECKING:
          import numba
      else:
          numba = import_optional_dependency("numba")
  
      if numba.extending.is_jitted(func):
          # Don't jit a user passed jitted function
          numba_func = func
      else:
  
          @numba.generated_jit(
              nopython=nopython, nogil=nogil, parallel=parallel
          )
          def numba_func(data, *_args):
              if getattr(
                  np, func.__name__, False
              ) is func or isinstance(func, types.BuiltinFunctionType):
                  jf = func
              else:
                  jf = numba.jit(func, nopython=nopython, nogil=nogil)
  
              def impl(data, *_args):
                  return jf(data, *_args)
  
              return impl
  
      return numba_func
  
file_path: catboost/contrib/python/pandas/py3/pandas/core/util/numba_.py
imports: from __future__ import annotations
  import types
  from typing import TYPE_CHECKING, Callable
  import numpy
  from pandas.compat._optional import import_optional_dependency
  from pandas.errors import NumbaUtilError
label_desc: Use image node_id 4 for calling a global function with example usage: jit_user_function(func, nopython, nogil, parallel) and returns: numba_func, impl, jf