#NEWLINE# def dmp_ground_primitive( f , u , K ) : #NEWLINE# #INDENT# '\n    Compute content and the primitive form of ``f`` in ``K[X]``.\n\n    Examples\n    ========\n\n    >>> from sympy.polys import ring, ZZ, QQ\n\n    >>> R, x,y = ring("x,y", ZZ)\n    >>> f = 2*x*y + 6*x + 4*y + 12\n\n    >>> R.dmp_ground_primitive(f)\n    (2, x*y + 3*x + 2*y + 6)\n\n    >>> R, x,y = ring("x,y", QQ)\n    >>> f = 2*x*y + 6*x + 4*y + 12\n\n    >>> R.dmp_ground_primitive(f)\n    (2, x*y + 3*x + 2*y + 6)\n\n    ' #NEWLINE# if ( not u ) : #NEWLINE# #INDENT# return dup_primitive ( f , K ) #NEWLINE# #UNINDENT# if dmp_zero_p ( f , u ) : #NEWLINE# #INDENT# return ( K . zero , f ) #NEWLINE# #UNINDENT# cont = dmp_ground_content ( f , u , K ) #NEWLINE# if K . is_one ( cont ) : #NEWLINE# #INDENT# return ( cont , f ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return ( cont , dmp_quo_ground ( f , cont , u , K ) )