'Construct a polynomial from a ``dict``.'

@classmethod
def _from_dict(cls, rep, opt):

    gens = opt.gens
    if (not gens):
        raise GeneratorsNeeded("can't    initialize    from    'dict'    without    generators")
    level = (len(gens) - 1)
    domain = opt.domain
    if (domain is None):
        (domain, rep) = construct_domain(rep, opt=opt)
    else:
        for (monom, coeff) in rep.items():
            rep[monom] = domain.convert(coeff)
    return cls.new(DMP.from_dict(rep, level, domain), *gens)
