Only encode for py2