def solveset(f, symbol=None, domain=S.Complexes):
    "Solves a given inequality or equation with set as output\n\n    Parameters\n    ==========\n\n    f : Expr or a relational.\n        The target equation or inequality\n    symbol : Symbol\n        The variable for which the equation is solved\n    domain : Set\n        The domain over which the equation is solved\n\n    Returns\n    =======\n\n    Set\n        A set of values for `symbol` for which `f` is True or is equal to\n        zero. An `EmptySet` is returned if `f` is False or nonzero.\n        A `ConditionSet` is returned as unsolved object if algorithms\n        to evaluate complete solution are not yet implemented.\n\n    `solveset` claims to be complete in the solution set that it returns.\n\n    Raises\n    ======\n\n    NotImplementedError\n        The algorithms to solve inequalities in complex domain  are\n        not yet implemented.\n    ValueError\n        The input is not valid.\n    RuntimeError\n        It is a bug, please report to the github issue tracker.\n\n\n    Notes\n    =====\n\n    Python interprets 0 and 1 as False and True, respectively, but\n    in this function they refer to solutions of an expression. So 0 and 1\n    return the Domain and EmptySet, respectively, while True and False\n    return the opposite (as they are assumed to be solutions of relational\n    expressions).\n\n\n    See Also\n    ========\n\n    solveset_real: solver for real domain\n    solveset_complex: solver for complex domain\n\n    Examples\n    ========\n\n    >>> from sympy import exp, sin, Symbol, pprint, S\n    >>> from sympy.solvers.solveset import solveset, solveset_real\n\n    * The default domain is complex. Not specifying a domain will lead\n      to the solving of the equation in the complex domain (and this\n      is not affected by the assumptions on the symbol):\n\n    >>> x = Symbol('x')\n    >>> pprint(solveset(exp(x) - 1, x), use_unicode=False)\n    {2*n*I*pi | n in Integers()}\n\n    >>> x = Symbol('x', real=True)\n    >>> pprint(solveset(exp(x) - 1, x), use_unicode=False)\n    {2*n*I*pi | n in Integers()}\n\n    * If you want to use `solveset` to solve the equation in the\n      real domain, provide a real domain. (Using `solveset\\_real`\n      does this automatically.)\n\n    >>> R = S.Reals\n    >>> x = Symbol('x')\n    >>> solveset(exp(x) - 1, x, R)\n    {0}\n    >>> solveset_real(exp(x) - 1, x)\n    {0}\n\n    The solution is mostly unaffected by assumptions on the symbol,\n    but there may be some slight difference:\n\n    >>> pprint(solveset(sin(x)/x,x), use_unicode=False)\n    ({2*n*pi | n in Integers()} \\ {0}) U ({2*n*pi + pi | n in Integers()} \\ {0})\n\n    >>> p = Symbol('p', positive=True)\n    >>> pprint(solveset(sin(p)/p, p), use_unicode=False)\n    {2*n*pi | n in Integers()} U {2*n*pi + pi | n in Integers()}\n\n    * Inequalities can be solved over the real domain only. Use of a complex\n      domain leads to a NotImplementedError.\n\n    >>> solveset(exp(x) > 1, x, R)\n    (0, oo)\n\n    "
    f = sympify(f)
    if (f is S.true):
        return domain
    if (f is S.false):
        return S.EmptySet
    if (not isinstance(f, (Expr, Number))):
        raise ValueError(('%s is not a valid SymPy expression' % f))
    free_symbols = f.free_symbols
    if (not free_symbols):
        b = Eq(f, 0)
        if (b is S.true):
            return domain
        elif (b is S.false):
            return S.EmptySet
        else:
            raise NotImplementedError(filldedent(('\n                relationship between value and 0 is unknown: %s' % b)))
    if (symbol is None):
        if (len(free_symbols) == 1):
            symbol = free_symbols.pop()
        else:
            raise ValueError(filldedent('\n                The independent variable must be specified for a\n                multivariate equation.'))
    elif (not getattr(symbol, 'is_Symbol', False)):
        raise ValueError(('A Symbol must be given, not type %s: %s' % (type(symbol), symbol)))
    if isinstance(f, Eq):
        from sympy.core import Add
        f = Add(f.lhs, (- f.rhs), evaluate=False)
    elif f.is_Relational:
        if (not domain.is_subset(S.Reals)):
            raise NotImplementedError(filldedent('\n                Inequalities in the complex domain are\n                not supported. Try the real domain by\n                setting domain=S.Reals'))
        try:
            result = (solve_univariate_inequality(f, symbol, relational=False) - _invalid_solutions(f, symbol, domain))
        except NotImplementedError:
            result = ConditionSet(symbol, f, domain)
        return result
    return _solveset(f, symbol, domain, _check=True)
Solves a given inequality or equation with set as output

Parameters
==========

f : Expr or a relational.
    The target equation or inequality
symbol : Symbol
    The variable for which the equation is solved
domain : Set
    The domain over which the equation is solved

Returns
=======

Set
    A set of values for `symbol` for which `f` is True or is equal to
    zero. An `EmptySet` is returned if `f` is False or nonzero.
    A `ConditionSet` is returned as unsolved object if algorithms
    to evaluate complete solution are not yet implemented.

`solveset` claims to be complete in the solution set that it returns.

Raises
======

NotImplementedError
    The algorithms to solve inequalities in complex domain  are
    not yet implemented.
ValueError
    The input is not valid.
RuntimeError
    It is a bug, please report to the github issue tracker.


Notes
=====

Python interprets 0 and 1 as False and True, respectively, but
in this function they refer to solutions of an expression. So 0 and 1
return the Domain and EmptySet, respectively, while True and False
return the opposite (as they are assumed to be solutions of relational
expressions).


See Also
========

solveset_real: solver for real domain
solveset_complex: solver for complex domain

Examples
========

>>> from sympy import exp, sin, Symbol, pprint, S
>>> from sympy.solvers.solveset import solveset, solveset_real

* The default domain is complex. Not specifying a domain will lead
  to the solving of the equation in the complex domain (and this
  is not affected by the assumptions on the symbol):

>>> x = Symbol('x')
>>> pprint(solveset(exp(x) - 1, x), use_unicode=False)
{2*n*I*pi | n in Integers()}

>>> x = Symbol('x', real=True)
>>> pprint(solveset(exp(x) - 1, x), use_unicode=False)
{2*n*I*pi | n in Integers()}

* If you want to use `solveset` to solve the equation in the
  real domain, provide a real domain. (Using `solveset\_real`
  does this automatically.)

>>> R = S.Reals
>>> x = Symbol('x')
>>> solveset(exp(x) - 1, x, R)
{0}
>>> solveset_real(exp(x) - 1, x)
{0}

The solution is mostly unaffected by assumptions on the symbol,
but there may be some slight difference:

>>> pprint(solveset(sin(x)/x,x), use_unicode=False)
({2*n*pi | n in Integers()} \ {0}) U ({2*n*pi + pi | n in Integers()} \ {0})

>>> p = Symbol('p', positive=True)
>>> pprint(solveset(sin(p)/p, p), use_unicode=False)
{2*n*pi | n in Integers()} U {2*n*pi + pi | n in Integers()}

* Inequalities can be solved over the real domain only. Use of a complex
  domain leads to a NotImplementedError.

>>> solveset(exp(x) > 1, x, R)
(0, oo)
def solveset(f, symbol=None, domain=S.Complexes):
    "Solves a given inequality or equation with set as output\n\n    Parameters\n    ==========\n\n    f : Expr or a relational.\n        The target equation or inequality\n    symbol : Symbol\n        The variable for which the equation is solved\n    domain : Set\n        The domain over which the equation is solved\n\n    Returns\n    =======\n\n    Set\n        A set of values for `symbol` for which `f` is True or is equal to\n        zero. An `EmptySet` is returned if `f` is False or nonzero.\n        A `ConditionSet` is returned as unsolved object if algorithms\n        to evaluate complete solution are not yet implemented.\n\n    `solveset` claims to be complete in the solution set that it returns.\n\n    Raises\n    ======\n\n    NotImplementedError\n        The algorithms to solve inequalities in complex domain  are\n        not yet implemented.\n    ValueError\n        The input is not valid.\n    RuntimeError\n        It is a bug, please report to the github issue tracker.\n\n\n    Notes\n    =====\n\n    Python interprets 0 and 1 as False and True, respectively, but\n    in this function they refer to solutions of an expression. So 0 and 1\n    return the Domain and EmptySet, respectively, while True and False\n    return the opposite (as they are assumed to be solutions of relational\n    expressions).\n\n\n    See Also\n    ========\n\n    solveset_real: solver for real domain\n    solveset_complex: solver for complex domain\n\n    Examples\n    ========\n\n    >>> from sympy import exp, sin, Symbol, pprint, S\n    >>> from sympy.solvers.solveset import solveset, solveset_real\n\n    * The default domain is complex. Not specifying a domain will lead\n      to the solving of the equation in the complex domain (and this\n      is not affected by the assumptions on the symbol):\n\n    >>> x = Symbol('x')\n    >>> pprint(solveset(exp(x) - 1, x), use_unicode=False)\n    {2*n*I*pi | n in Integers()}\n\n    >>> x = Symbol('x', real=True)\n    >>> pprint(solveset(exp(x) - 1, x), use_unicode=False)\n    {2*n*I*pi | n in Integers()}\n\n    * If you want to use `solveset` to solve the equation in the\n      real domain, provide a real domain. (Using `solveset\\_real`\n      does this automatically.)\n\n    >>> R = S.Reals\n    >>> x = Symbol('x')\n    >>> solveset(exp(x) - 1, x, R)\n    {0}\n    >>> solveset_real(exp(x) - 1, x)\n    {0}\n\n    The solution is mostly unaffected by assumptions on the symbol,\n    but there may be some slight difference:\n\n    >>> pprint(solveset(sin(x)/x,x), use_unicode=False)\n    ({2*n*pi | n in Integers()} \\ {0}) U ({2*n*pi + pi | n in Integers()} \\ {0})\n\n    >>> p = Symbol('p', positive=True)\n    >>> pprint(solveset(sin(p)/p, p), use_unicode=False)\n    {2*n*pi | n in Integers()} U {2*n*pi + pi | n in Integers()}\n\n    * Inequalities can be solved over the real domain only. Use of a complex\n      domain leads to a NotImplementedError.\n\n    >>> solveset(exp(x) > 1, x, R)\n    (0, oo)\n\n    "
    f = sympify(f)
    if (f is S.true):
        return domain
    if (f is S.false):
        return S.EmptySet
    if (not isinstance(f, (Expr, Number))):
        raise ValueError(('%s is not a valid SymPy expression' % f))
    free_symbols = f.free_symbols
    if (not free_symbols):
        b = Eq(f, 0)
        if (b is S.true):
            return domain
        elif (b is S.false):
            return S.EmptySet
        else:
            raise NotImplementedError(filldedent(('\n                relationship between value and 0 is unknown: %s' % b)))
    if (symbol is None):
        if (len(free_symbols) == 1):
            symbol = free_symbols.pop()
        else:
            raise ValueError(filldedent('\n                The independent variable must be specified for a\n                multivariate equation.'))
    elif (not getattr(symbol, 'is_Symbol', False)):
        raise ValueError(('A Symbol must be given, not type %s: %s' % (type(symbol), symbol)))
    if isinstance(f, Eq):
        from sympy.core import Add
        f = Add(f.lhs, (- f.rhs), evaluate=False)
    elif f.is_Relational:
        if (not domain.is_subset(S.Reals)):
            raise NotImplementedError(filldedent('\n                Inequalities in the complex domain are\n                not supported. Try the real domain by\n                setting domain=S.Reals'))
        try:
            result = (solve_univariate_inequality(f, symbol, relational=False) - _invalid_solutions(f, symbol, domain))
        except NotImplementedError:
            result = ConditionSet(symbol, f, domain)
        return result
    return _solveset(f, symbol, domain, _check=True)