'Reduce ``f`` modulo a constant ``p``.
Examples
>>> from sympy import Poly
>>> from sympy.abc import x
>>> Poly(2*x**3 + 3*x**2 + 5*x + 7, x).trunc(3)
Poly(-x**3 - x + 1, x, domain=\'ZZ\')'

def trunc(f, p):

    p = f.rep.dom.convert(p)
    if hasattr(f.rep, 'trunc'):
        result = f.rep.trunc(p)
    else:
        raise OperationNotSupported(f, 'trunc')
    return f.per(result)
