(p1, x, prec)
return p
truncate the series in the ``x`` variable with precision ``prec``,
    that is modulo ``O(x**prec)``

    Examples
    ========

    >>> from sympy.polys.domains import QQ
    >>> from sympy.polys.rings import ring
    >>> from sympy.polys.ring_series import rs_trunc
    >>> R, x = ring('x', QQ)
    >>> p = x**10 + x**5 + x + 1
    >>> rs_trunc(p, x, 12)
    x**10 + x**5 + x + 1
    >>> rs_trunc(p, x, 10)
    x**5 + x + 1
truncate the series in the ``x`` variable with precision ``prec``,
    that is modulo ``O(x**prec)``
truncate the series in the x variable with precision prec that is modulo O ( x ** prec )
def rs_trunc(p1, x, prec):
    """
    truncate the series in the ``x`` variable with precision ``prec``,
    that is modulo ``O(x**prec)``

    Examples
    ========

    >>> from sympy.polys.domains import QQ
    >>> from sympy.polys.rings import ring
    >>> from sympy.polys.ring_series import rs_trunc
    >>> R, x = ring('x', QQ)
    >>> p = x**10 + x**5 + x + 1
    >>> rs_trunc(p, x, 12)
    x**10 + x**5 + x + 1
    >>> rs_trunc(p, x, 10)
    x**5 + x + 1
    """

    ring = p1.ring
    p = ring.zero
    i = ring.gens.index(x)
    for exp1 in p1:
        if exp1[i] >= prec:
            continue
        p[exp1] = p1[exp1]
    return p
def rs_trunc ( p1 , x , prec ) : ring = p1 . ring p = ring . zero i = ring . gens . index ( x ) for exp1 in p1 : if exp1 [ i ] >= prec : continue p [ exp1 ] = p1 [ exp1 ] return p