code: def dup_revert(f, n, K):
      """
      Compute ``f**(-1)`` mod ``x**n`` using Newton iteration.
  
      This function computes first ``2**n`` terms of a polynomial that
      is a result of inversion of a polynomial modulo ``x**n``. This is
      useful to efficiently compute series expansion of ``1/f``.
  
      Examples
      ========
  
      >>> from sympy.polys import ring, QQ
      >>> R, x = ring("x", QQ)
  
      >>> f = -QQ(1,720)*x**6 + QQ(1,24)*x**4 - QQ(1,2)*x**2 + 1
  
      >>> R.dup_revert(f, 8)
      61/720*x**6 + 5/24*x**4 + 1/2*x**2 + 1
  
      """
      g = [K.revert(dup_TC(f, K))]
      h = [K.one, K.zero, K.zero]
  
      N = int(_ceil(_log(n, 2)))
  
      for i in range(1, N + 1):
          a = dup_mul_ground(g, K(2), K)
          b = dup_mul(f, dup_sqr(g, K), K)
          g = dup_rem(dup_sub(a, b, K), h, K)
          h = dup_lshift(h, dup_degree(h), K)
  
      return g
  
imports: from sympy.polys.densearith import dup_add_term, dmp_add_term, dup_lshift, dup_add, dmp_add, dup_sub, dmp_sub, dup_mul, dmp_mul, dup_sqr, dup_div, dup_rem, dmp_rem, dmp_expand, dup_mul_ground, dmp_mul_ground, dup_quo_ground, dmp_quo_ground, dup_exquo_ground, dmp_exquo_ground
  from sympy.polys.densebasic import dup_strip, dmp_strip, dup_convert, dmp_convert, dup_degree, dmp_degree, dmp_to_dict, dmp_from_dict, dup_LC, dmp_LC, dmp_ground_LC, dup_TC, dmp_TC, dmp_zero, dmp_ground, dmp_zero_p, dup_to_raw_dict, dup_from_raw_dict, dmp_zeros
  from sympy.polys.polyerrors import MultivariatePolynomialError, DomainError
  from sympy.utilities import variations
  from math import ceil, log
label_desc: Use image node_id 44 for calling a global function with example usage: dup_revert(f, n, K) and returns: g