Here is a code that should work in both Python 2.x and 3.x
Obviously you will need the six
module, but it's almost impossible to write modules that work in both versions without six.
try:
import configparser
except:
from six.moves import configparser