code: def cholesky_impl(A, lower=0, overwrite_a=False, check_finite=True):
      ensure_lapack()
      _check_scipy_linalg_matrix(A, "cholesky")
      dtype = A.dtype
      w_type = _get_underlying_float(dtype)
      numba_potrf = _LAPACK().numba_xpotrf(dtype)
  
      def impl(A, lower=0, overwrite_a=False, check_finite=True):
          _N = np.int32(A.shape[-1])
          if A.shape[-2] != _N:
              raise linalg.LinAlgError(
                  "Last 2 dimensions of A must be square"
              )
  
          UPLO = val_to_int_ptr(ord("L") if lower else ord("U"))
          N = val_to_int_ptr(_N)
          LDA = val_to_int_ptr(_N)
          INFO = val_to_int_ptr(0)
  
          if not overwrite_a:
              A_copy = _copy_to_fortran_order(A)
          else:
              A_copy = A
  
          numba_potrf(
              UPLO,
              N,
              A_copy.view(w_type).ctypes,
              LDA,
              INFO,
          )
  
          return A_copy, int_ptr_to_val(INFO)
  
      return impl
  
imports: import ctypes
  import numba
  import numpy
  from numba.core import cgutils, types
  from numba.extending import get_cython_function_address, intrinsic, overload
  from numba.np.linalg import _copy_to_fortran_order, ensure_lapack, get_blas_kind
  from scipy import linalg
  from pytensor.link.numba.dispatch import basic
  from pytensor.link.numba.dispatch.basic import numba_funcify
  from pytensor.tensor.slinalg import BlockDiagonal, Cholesky, SolveTriangular
label_desc: Use image node_id 17 for calling a global function with example usage: cholesky_impl(A, lower, overwrite_a, check_finite) and returns: impl, A_copy,  int_ptr_to_val