code: def dup_pdiv(f, g, K):
      """
      Polynomial pseudo-division in ``K[x]``.
  
      Examples
      ========
  
      >>> from sympy.polys import ring, ZZ
      >>> R, x = ring("x", ZZ)
  
      >>> R.dup_pdiv(x**2 + 1, 2*x - 4)
      (2*x + 4, 20)
  
      """
      df = dup_degree(f)
      dg = dup_degree(g)
  
      q, r, dr = [], f, df
  
      if not g:
          raise ZeroDivisionError("polynomial division")
      elif df < dg:
          return q, r
  
      N = df - dg + 1
      lc_g = dup_LC(g, K)
  
      while True:
          lc_r = dup_LC(r, K)
          j, N = dr - dg, N - 1
  
          Q = dup_mul_ground(q, lc_g, K)
          q = dup_add_term(Q, lc_r, j, K)
  
          R = dup_mul_ground(r, lc_g, K)
          G = dup_mul_term(g, lc_r, j, K)
          r = dup_sub(R, G, K)
  
          _dr, dr = dr, dup_degree(r)
  
          if dr < dg:
              break
          elif not (dr < _dr):
              raise PolynomialDivisionFailed(f, g, K)
  
      c = lc_g**N
  
      q = dup_mul_ground(q, c, K)
      r = dup_mul_ground(r, c, K)
  
      return q, r
  
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 37 for calling a global function with example usage: dup_pdiv(f, g, K) and returns: q,  r, q,  r