Move compatibility version testing to compatibility.py

This consolidates version checking and makes the appropriate imports
from sympy/core/compaitibility.py.
Merge pull request #2629 from flacjacket/fix_version

Move compatibility version testing to compatibility.py