code: def mpc_psi0(z, prec, rnd=round_fast):
      """
      Computation of the digamma function (psi function of order 0)
      of a complex argument.
      """
      re, im = z
      # Fall back to the real case
      if im == fzero:
          return (mpf_psi0(re, prec, rnd), fzero)
      wp = prec + 20
      sign, man, exp, bc = re
      # Reflection formula
      if sign and exp + bc > 3:
          c = mpc_cos_pi(z, wp)
          s = mpc_sin_pi(z, wp)
          q = mpc_mul_mpf(mpc_div(c, s, wp), mpf_pi(wp), wp)
          p = mpc_psi0(mpc_sub(mpc_one, z, wp), wp)
          return mpc_sub(p, q, prec, rnd)
      # Just the logarithmic term
      if (not sign) and bc + exp > wp:
          return mpc_log(mpc_sub(z, mpc_one, wp), prec, rnd)
      # Initial recurrence to obtain a large enough z
      w = to_int(re)
      n = int(0.11 * wp) + 2
      s = mpc_zero
      if w < n:
          for k in xrange(w, n):
              s = mpc_sub(s, mpc_reciprocal(z, wp), wp)
              z = mpc_add_mpf(z, fone, wp)
      z = mpc_sub(z, mpc_one, wp)
      # Logarithmic and endpoint term
      s = mpc_add(s, mpc_log(z, wp), wp)
      s = mpc_add(s, mpc_div(mpc_half, z, wp), wp)
      # Euler-Maclaurin remainder sum
      z2 = mpc_square(z, wp)
      t = mpc_one
      prev = mpc_zero
      szprev = fzero
      k = 1
      eps = mpf_shift(fone, -wp + 2)
      while 1:
          t = mpc_mul(t, z2, wp)
          bern = mpf_bernoulli(2 * k, wp)
          term = mpc_mpf_div(bern, mpc_mul_int(t, 2 * k, wp), wp)
          s = mpc_sub(s, term, wp)
          szterm = mpc_abs(term, 10)
          if k > 2 and (mpf_le(szterm, eps) or mpf_le(szprev, szterm)):
              break
          prev = term
          szprev = szterm
          k += 1
      return s
  
imports: import math
  import sys
  from .backend import xrange
  from .backend import MPZ, MPZ_ZERO, MPZ_ONE, MPZ_THREE, gmpy
  from .libintmath import list_primes, ifac, ifac2, moebius
  from .libmpf import round_floor, round_ceiling, round_down, round_up, round_nearest, round_fast, lshift, sqrt_fixed, isqrt_fast, fzero, fone, fnone, fhalf, ftwo, finf, fninf, fnan, from_int, to_int, to_fixed, from_man_exp, from_rational, mpf_pos, mpf_neg, mpf_abs, mpf_add, mpf_sub, mpf_mul, mpf_mul_int, mpf_div, mpf_sqrt, mpf_pow_int, mpf_rdiv_int, mpf_perturb, mpf_le, mpf_lt, mpf_gt, mpf_shift, negative_rnd, reciprocal_rnd, bitcount, to_float, mpf_floor, mpf_sign, ComplexResult
  from .libelefun import constant_memo, def_mpf_constant, mpf_pi, pi_fixed, ln2_fixed, log_int_fixed, mpf_ln2, mpf_exp, mpf_log, mpf_pow, mpf_cosh, mpf_cos_sin, mpf_cosh_sinh, mpf_cos_sin_pi, mpf_cos_pi, mpf_sin_pi, ln_sqrt2pi_fixed, mpf_ln_sqrt2pi, sqrtpi_fixed, mpf_sqrtpi, cos_sin_fixed, exp_fixed
  from .libmpc import mpc_zero, mpc_one, mpc_half, mpc_two, mpc_abs, mpc_shift, mpc_pos, mpc_neg, mpc_add, mpc_sub, mpc_mul, mpc_div, mpc_add_mpf, mpc_mul_mpf, mpc_div_mpf, mpc_mpf_div, mpc_mul_int, mpc_pow_int, mpc_log, mpc_exp, mpc_pow, mpc_cos_pi, mpc_sin_pi, mpc_reciprocal, mpc_square, mpc_sub_mpf
label_desc: Use image node_id 15 for calling a global function with example usage: mpc_psi0(z, prec, rnd) and returns: s, mpf_psi0,  fzero, mpc_sub, mpc_log