Cherry-picked updates from pyside_support branch to make the code compatible with python 2.6 in Maya 2012.