'Create a DMF out of the given representation.'

def per(f, num, den, cancel=True, kill=False, ring=None):

    (lev, dom) = (f.lev, f.dom)
    if kill:
        if (not lev):
            return (num / den)
        else:
            lev -= 1
    if cancel:
        (num, den) = dmp_cancel(num, den, lev, dom)
    if (ring is None):
        ring = f.ring
    return f.__class__.new((num, den), dom, lev, ring=ring)
