code: def besselk(ctx, n, z, **kwargs):
      if not z:
          return ctx.inf
      M = ctx.mag(z)
      if M < 1:
          # Represent as limit definition
          def h(n):
              r = (z / 2) ** 2
              T1 = [z, 2], [-n, n - 1], [n], [], [], [1 - n], r
              T2 = [z, 2], [n, -n - 1], [-n], [], [], [1 + n], r
              return T1, T2
  
      # We could use the limit definition always, but it leads
      # to very bad cancellation (of exponentially large terms)
      # for large real z
      # Instead represent in terms of 2F0
      else:
          ctx.prec += M
  
          def h(n):
              return [
                  (
                      [ctx.pi / 2, z, ctx.exp(-z)],
                      [0.5, -0.5, 1],
                      [],
                      [],
                      [n + 0.5, 0.5 - n],
                      [],
                      -1 / (2 * z),
                  )
              ]
  
      return ctx.hypercomb(h, [n], **kwargs)
  
imports: from .functions import defun, defun_wrapped
label_desc: Use image node_id 6 for calling a global function with example usage: besselk(ctx, n, z) and returns: ctx, ctx, T1,  T2, list