code: def kernel_pdf_gamma2(x, sample, bw):
      # Gamma kernel for density, pdf, estimation with boundary correction
      if np.size(x) == 1:
          # without vectorizing, easier to read
          if x < 2 * bw:
              a = (x / bw) ** 2 + 1
          else:
              a = x / bw
      else:
          a = x / bw
          mask = x < 2 * bw
          a[mask] = a[mask] ** 2 + 1
      pdf = stats.gamma.pdf(sample, a, scale=bw)
  
      return pdf
  
imports: import numpy
  from scipy import special, stats
label_desc: Use image node_id 11 for calling a global function with example usage: kernel_pdf_gamma2(x, sample, bw) and returns: pdf