def field_isomorphism(a, b, **args):
    'Construct an isomorphism between two number fields.'
    if (not all((isinstance(_, AlgebraicField) for _ in (a, b)))):
        raise ValueError(f'Arguments should be algebraic fields, got {a} and {b}')
    if (a == b):
        return a.unit.rep.all_coeffs()
    n = a.minpoly.degree()
    m = b.minpoly.degree()
    if (a.domain == b.domain):
        if (m % n):
            return
        elif a.domain.is_RationalField:
            da = a.minpoly.discriminant()
            db = b.minpoly.discriminant()
            k = (m // n)
            for (p, q) in factorint(da).items():
                if ((q % 2) and (db % (p ** k))):
                    return
    if args.get('fast', True):
        try:
            result = field_isomorphism_pslq(a, b)
            if (result is not None):
                return result
        except NotImplementedError:
            pass
    return field_isomorphism_factor(a, b)
Construct an isomorphism between two number fields.
def field_isomorphism(a, b, **args):
    
    if (not all((isinstance(_, AlgebraicField) for _ in (a, b)))):
        raise ValueError(f'Arguments should be algebraic fields, got {a} and {b}')
    if (a == b):
        return a.unit.rep.all_coeffs()
    n = a.minpoly.degree()
    m = b.minpoly.degree()
    if (a.domain == b.domain):
        if (m % n):
            return
        elif a.domain.is_RationalField:
            da = a.minpoly.discriminant()
            db = b.minpoly.discriminant()
            k = (m // n)
            for (p, q) in factorint(da).items():
                if ((q % 2) and (db % (p ** k))):
                    return
    if args.get('fast', True):
        try:
            result = field_isomorphism_pslq(a, b)
            if (result is not None):
                return result
        except NotImplementedError:
            pass
    return field_isomorphism_factor(a, b)