

def __new__(cls, lamda, base_set):
    if (not isinstance(lamda, Lambda)):
        raise ValueError('first argument must be a Lambda')
    if (lamda is S.IdentityFunction):
        return base_set
    if ((not lamda.expr.free_symbols) or (not lamda.expr.args)):
        return FiniteSet(lamda.expr)
    return Basic.__new__(cls, lamda, base_set)

dataset/ETHPy150Open sympy/sympy/sympy/sets/fancysets.py ImageSet.__new__/original