code: def dup_pow(f, n, K):
      """
      Raise ``f`` to the ``n``-th power in ``K[x]``.
  
      Examples
      ========
  
      >>> from sympy.polys import ring, ZZ
      >>> R, x = ring("x", ZZ)
  
      >>> R.dup_pow(x - 2, 3)
      x**3 - 6*x**2 + 12*x - 8
  
      """
      if not n:
          return [K.one]
      if n < 0:
          raise ValueError(
              "Cannot raise polynomial to a negative power"
          )
      if n == 1 or not f or f == [K.one]:
          return f
  
      g = [K.one]
  
      while True:
          n, m = n // 2, n
  
          if m % 2:
              g = dup_mul(g, f, K)
  
              if not n:
                  break
  
          f = dup_sqr(f, K)
  
      return g
  
imports: from sympy.polys.densebasic import dup_slice, dup_LC, dmp_LC, dup_degree, dmp_degree, dup_strip, dmp_strip, dmp_zero_p, dmp_zero, dmp_one_p, dmp_one, dmp_ground, dmp_zeros
  from sympy.polys.polyerrors import ExactQuotientFailed, PolynomialDivisionFailed
label_desc: Use image node_id 35 for calling a global function with example usage: dup_pow(f, n, K) and returns: g, list, f