# Buggy code
def get_sat_solver_cls(name=None):
    solvers = odict(
        [
            ("pycosat", PycoSatSolver),
            ("pycryptosat", CryptoMiniSatSolver),
            ("pysat", PySatSolver),
        ]
    )
    if name is not None:
        try:
            cls = solvers[name]
        except KeyError:
            raise ValueError('Unknown SAT solver interface: "{}".'.format(name))
        try:
            cls().run(0)
        except Exception:
            raise RuntimeError(
                'Could not run SAT solver through interface "{}".'.format(name)
            )
        else:
            log.debug('Using SAT solver interface "{}".'.format(name))
            return cls
    for name, cls in solvers.items():
        try:
            cls().run(0)
        except Exception:
            log.warn('Could not run SAT solver through interface "{}".'.format(name))
        else:
            log.debug('Using SAT solver interface "{}".'.format(name))
            return cls
    raise RuntimeError("Could not run any SAT solver.")


# Traceback (RuntimeError)
error: RuntimeError('Could not run any SAT solver.')
command: C:\Tools\Progs\python\anaconda3\scripts\conda-script.py install -p C:\Tools\Progs\python\anaconda3 -y anaconda-client==1.7.2
user_agent: conda/4.6.1 requests/2.21.0 CPython/3.7.1 Windows/10 Windows/10.0.15063
_messageid: -9223372036617369659
_messagetime: 1548779675918 / 2019-01-29 10:34:35

Traceback (most recent call last):
File "C:\Tools\Progs\python\anaconda3\lib\site-packages\conda\exceptions.py", line 1001, in __call__
return func(*args, **kwargs)
File "C:\Tools\Progs\python\anaconda3\lib\site-packages\conda\cli\main.py", line 84, in _main
exit_code = do_call(args, p)
File "C:\Tools\Progs\python\anaconda3\lib\site-packages\conda\cli\conda_argparse.py", line 81, in do_call
exit_code = getattr(module, func_name)(args, parser)
File "C:\Tools\Progs\python\anaconda3\lib\site-packages\conda\cli\main_install.py", line 21, in execute
install(args, parser, 'install')
File "C:\Tools\Progs\python\anaconda3\lib\site-packages\conda\cli\install.py", line 250, in install
force_reinstall=context.force_reinstall or context.force,
File "C:\Tools\Progs\python\anaconda3\lib\site-packages\conda\core\solve.py", line 107, in solve_for_transaction
force_remove, force_reinstall)
File "C:\Tools\Progs\python\anaconda3\lib\site-packages\conda\core\solve.py", line 145, in solve_for_diff
force_remove)
File "C:\Tools\Progs\python\anaconda3\lib\site-packages\conda\core\solve.py", line 240, in solve_final_state
ssc = self._find_inconsistent_packages(ssc)
File "C:\Tools\Progs\python\anaconda3\lib\site-packages\conda\core\solve.py", line 342, in _find_inconsistent_packages
_, inconsistent_precs = ssc.r.bad_installed(ssc.solution_precs, ())
File "C:\Tools\Progs\python\anaconda3\lib\site-packages\conda\resolve.py", line 896, in bad_installed
C = r2.gen_clauses()
File "C:\Tools\Progs\python\anaconda3\lib\site-packages\conda\common\io.py", line 85, in decorated
return f(*args, **kwds)
File "C:\Tools\Progs\python\anaconda3\lib\site-packages\conda\resolve.py", line 668, in gen_clauses
C = Clauses(sat_solver_cls=get_sat_solver_cls(context.sat_solver))
File "C:\Tools\Progs\python\anaconda3\lib\site-packages\conda\_vendor\auxlib\decorators.py", line 56, in _memoized_func
result = func(*args, **kwargs)
File "C:\Tools\Progs\python\anaconda3\lib\site-packages\conda\common\logic.py", line 293, in get_sat_solver_cls
raise RuntimeError('Could not run any SAT solver.')
RuntimeError: Could not run any SAT solver.

# Fixed code
def get_sat_solver_cls(sat_solver_choice=SatSolverChoice.PYCOSAT):
    solvers = odict(
        [
            (SatSolverChoice.PYCOSAT, PycoSatSolver),
            (SatSolverChoice.PYCRYPTOSAT, CryptoMiniSatSolver),
            (SatSolverChoice.PYSAT, PySatSolver),
        ]
    )
    cls = solvers[sat_solver_choice]
    try:
        cls().run(0)
    except Exception as e:
        log.warning(
            "Could not run SAT solver through interface '%s'.", sat_solver_choice
        )
        log.debug("SAT interface error due to: %s", e, exc_info=True)
    else:
        log.debug("Using SAT solver interface '%s'.", sat_solver_choice)
        return cls
    for solver_choice, cls in solvers.items():
        try:
            cls().run(0)
        except Exception as e:
            log.debug(
                "Attempted SAT interface '%s' but unavailable due to: %s",
                sat_solver_choice,
                e,
            )
        else:
            log.debug("Falling back to SAT solver interface '%s'.", sat_solver_choice)
            return cls
    from ..exceptions import CondaDependencyError

    raise CondaDependencyError(
        "Cannot run solver. No functioning SAT implementations available."
    )