Fix length check in python 3 PYTHON-571