ecs module: add backward-compatible support for Python 3.3+

All tests passed.