'Remove dummy generators from ``f`` that are to the left of
specified ``gen`` in the generators as ordered. When ``gen``
is an integer, it refers to the generator located at that
position within the tuple of generators of ``f``.
Examples
>>> from sympy import Poly
>>> from sympy.abc import x, y, z
>>> Poly(y**2 + y*z**2, x, y, z).ltrim(y)
Poly(y**2 + y*z**2, y, z, domain=\'ZZ\')
>>> Poly(z, x, y, z).ltrim(-1)
Poly(z, z, domain=\'ZZ\')'

def ltrim(f, gen):

    rep = f.as_dict(native=True)
    j = f._gen_to_level(gen)
    terms = {}
    for (monom, coeff) in rep.items():
        if any((i for i in monom[:j])):
            raise PolynomialError(("can't    left    trim    %s" % f))
        terms[monom[j:]] = coeff
    gens = f.gens[j:]
    return f.new(DMP.from_dict(terms, (len(gens) - 1), f.rep.dom), *gens)
