code: def dup_sqf_part(f, K):
      """
      Returns square-free part of a polynomial in ``K[x]``.
  
      Examples
      ========
  
      >>> from sympy.polys import ring, ZZ
      >>> R, x = ring("x", ZZ)
  
      >>> R.dup_sqf_part(x**3 - 3*x - 2)
      x**2 - x - 2
  
      """
      if K.is_FiniteField:
          return dup_gf_sqf_part(f, K)
  
      if not f:
          return f
  
      if K.is_negative(dup_LC(f, K)):
          f = dup_neg(f, K)
  
      gcd = dup_gcd(f, dup_diff(f, 1, K), K)
      sqf = dup_quo(f, gcd, K)
  
      if K.is_Field:
          return dup_monic(sqf, K)
      else:
          return dup_primitive(sqf, K)[1]
  
imports: from sympy.polys.densearith import dup_neg, dmp_neg, dup_sub, dmp_sub, dup_mul, dup_quo, dmp_quo, dup_mul_ground, dmp_mul_ground
  from sympy.polys.densebasic import dup_strip, dup_LC, dmp_ground_LC, dmp_zero_p, dmp_ground, dup_degree, dmp_degree, dmp_raise, dmp_inject, dup_convert
  from sympy.polys.densetools import dup_diff, dmp_diff, dmp_diff_in, dup_shift, dmp_compose, dup_monic, dmp_ground_monic, dup_primitive, dmp_ground_primitive
  from sympy.polys.euclidtools import dup_inner_gcd, dmp_inner_gcd, dup_gcd, dmp_gcd, dmp_resultant
  from sympy.polys.galoistools import gf_sqf_list, gf_sqf_part
  from sympy.polys.polyerrors import MultivariatePolynomialError, DomainError
label_desc: Use image node_id 8 for calling a global function with example usage: dup_sqf_part(f, K) and returns: dup_gf_sqf_part, f, dup_monic, dup_primitive