Add py27 compatibility layer.