def _solve_trig(f, symbol, domain):
    ' Helper to solve trigonometric equations '
    f = trigsimp(f)
    f_original = f
    f = f.rewrite(exp)
    f = together(f)
    (g, h) = fraction(f)
    y = Dummy('y')
    (g, h) = (g.expand(), h.expand())
    (g, h) = (g.subs(exp((I * symbol)), y), h.subs(exp((I * symbol)), y))
    if (g.has(symbol) or h.has(symbol)):
        return ConditionSet(symbol, Eq(f, 0), S.Reals)
    solns = (solveset_complex(g, y) - solveset_complex(h, y))
    if isinstance(solns, FiniteSet):
        result = Union(*[invert_complex(exp((I * symbol)), s, symbol)[1] for s in solns])
        return Intersection(result, domain)
    elif (solns is S.EmptySet):
        return S.EmptySet
    else:
        return ConditionSet(symbol, Eq(f_original, 0), S.Reals)
Helper to solve trigonometric equations
def _solve_trig(f, symbol, domain):
    '  '
    f = trigsimp(f)
    f_original = f
    f = f.rewrite(exp)
    f = together(f)
    (g, h) = fraction(f)
    y = Dummy('y')
    (g, h) = (g.expand(), h.expand())
    (g, h) = (g.subs(exp((I * symbol)), y), h.subs(exp((I * symbol)), y))
    if (g.has(symbol) or h.has(symbol)):
        return ConditionSet(symbol, Eq(f, 0), S.Reals)
    solns = (solveset_complex(g, y) - solveset_complex(h, y))
    if isinstance(solns, FiniteSet):
        result = Union(*[invert_complex(exp((I * symbol)), s, symbol)[1] for s in solns])
        return Intersection(result, domain)
    elif (solns is S.EmptySet):
        return S.EmptySet
    else:
        return ConditionSet(symbol, Eq(f_original, 0), S.Reals)