if sys.version_info[0] != 2 or sys.version_info[1] < 6:
    print('This script requires Python version 2.6')
sys.exit(1)
How to write Python code that is able to properly require a minimal python version?