code: def complex_accuracy(result: TMP_RES) -> tUnion[int, Any]:
      """
      Returns relative accuracy of a complex number with given accuracies
      for the real and imaginary parts. The relative accuracy is defined
      in the complex norm sense as ||z|+|error|| / |z| where error
      is equal to (real absolute error) + (imag absolute error)*i.
  
      The full expression for the (logarithmic) error can be approximated
      easily by using the max norm to approximate the complex norm.
  
      In the worst case (re and im equal), this is wrong by a factor
      sqrt(2), or by log2(sqrt(2)) = 0.5 bit.
      """
      if result is S.ComplexInfinity:
          return INF
      re, im, re_acc, im_acc = result
      if not im:
          if not re:
              return INF
          return re_acc
      if not re:
          return im_acc
      re_size = fastlog(re)
      im_size = fastlog(im)
      absolute_error = max(re_size - re_acc, im_size - im_acc)
      relative_error = absolute_error - max(re_size, im_size)
      return -relative_error
  
imports: from __future__ import annotations
  from typing import Tuple, Optional, Union, Callable, List, Dict, Type, TYPE_CHECKING, Any, overload
  import math
  import mpmath.libmp
  from mpmath import make_mpc, make_mpf, mp, mpc, mpf, nsum, quadts, quadosc, workprec
  from mpmath import inf
  from mpmath.libmp import from_int, from_man_exp, from_rational, fhalf, fnan, finf, fninf, fnone, fone, fzero, mpf_abs, mpf_add, mpf_atan, mpf_atan2, mpf_cmp, mpf_cos, mpf_e, mpf_exp, mpf_log, mpf_lt, mpf_mul, mpf_neg, mpf_pi, mpf_pow, mpf_pow_int, mpf_shift, mpf_sin, mpf_sqrt, normalize, round_nearest, to_int, to_str
  from mpmath.libmp import bitcount
  from mpmath.libmp.backend import MPZ
  from mpmath.libmp.libmpc import _infs_nan
  from mpmath.libmp.libmpf import dps_to_prec, prec_to_dps
  from .sympify import sympify
  from .singleton import S
  from sympy.external.gmpy import SYMPY_INTS
  from sympy.utilities.iterables import is_sequence
  from sympy.utilities.lambdify import lambdify
  from sympy.utilities.misc import as_int
label_desc: Use image node_id 8 for calling a global function with example usage: complex_accuracy(result) and returns: unknown, INF, re_acc, im_acc, INF