Move logic out of sympy/assumptions/handlers/__init__.py