def _solve_as_rational(f, symbol, domain):
    f = together(f, deep=True)
    g, h = fraction(f)
    if not h.has(symbol):
        return _solve_as_poly(g, symbol, domain)
    else:
        valid_solns = _solveset(g, symbol, domain)
        invalid_solns = _solveset(h, symbol, domain)
        return valid_solns - invalid_solns
solve rational functions
dataset/ETHPy150Open sympy/sympy/sympy/solvers/solveset.py/_solve_as_rational