import sys

# Python version flags for Python 3 support
PY2 = ( sys.version_info.major == 2 )
PY3 = ( sys.version_info.major == 3 )  

import sys

# Python version flags for Python 3 support
python_major_version = 0
if hasattr(sys.version_info, 'major'):
  python_major_version = sys.version_info.major
else:
  python_major_version = sys.version_info[0]

PY2 = ( python_major_version == 2 )
PY3 = ( python_major_version == 3 )  

Make this work on python2.6 again
Make this work on python2.6 again