Maintain behavior between python 2/3