code: def digamma(
      x: np.ndarray,
      /,
      *,
      out: Optional[np.ndarray] = None,
  ) -> np.ndarray:
      # Using `np.errstate` to ignore divide by zero error
      # to maintain the same behaviour as other frameworks.
      with np.errstate(divide="ignore", invalid="ignore"):
          x = np.asarray(x, dtype=x.dtype)
          zero = np.zeros_like(x)
          one_half = 0.5 * np.ones_like(x)
          one = np.ones_like(x)
          pi = np.pi * np.ones_like(x)
          lanczos_gamma = kLanczosGamma * np.ones_like(x)
          lanczos_gamma_plus_one_half = (
              kLanczosGamma + 0.5
          ) * np.ones_like(x)
          log_lanczos_gamma_plus_one_half = np.log(
              kLanczosGamma + 0.5
          ) * np.ones_like(x)
          base_lanczos_coeff = kBaseLanczosCoeff * np.ones_like(x)
          need_to_reflect = x < one_half
          z = np.where(need_to_reflect, -x, x - one)
  
          num = zero
          denom = base_lanczos_coeff
          for i in range(len(kLanczosCoefficients)):
              lanczos_coefficient = kLanczosCoefficients[
                  i
              ] * np.ones_like(x)
              index = i * np.ones_like(x)
              num = num - lanczos_coefficient / (
                  (z + index + one) * (z + index + one)
              )
              denom = denom + lanczos_coefficient / (z + index + one)
  
          t = lanczos_gamma_plus_one_half + z
          log_t = log_lanczos_gamma_plus_one_half + np.log1p(
              z / lanczos_gamma_plus_one_half
          )
          y = log_t + num / denom - lanczos_gamma / t
  
          reduced_x = x + np.abs(np.floor(x + 0.5))
          reflection = y - pi * np.cos(pi * reduced_x) / np.sin(
              pi * reduced_x
          )
          real_result = np.where(need_to_reflect, reflection, y)
  
          return np.where(
              np.logical_and(x <= zero, x == np.floor(x)),
              np.nan,
              real_result,
          )
  
imports: from typing import Optional, Union, Tuple, List, Sequence
  import numpy
  import numpy.typing
  import ivy
  from ivy import promote_types_of_inputs
  from ivy.functional.backends.numpy.helpers import _scalar_output_to_0d_array
  from ivy.func_wrapper import with_unsupported_dtypes
  from .None import backend_version
label_desc: Use image node_id 23 for calling a global function with example usage: digamma() and returns: np