modfiying api for py3