Update libgeos.py

Backporting fix from https://code.djangoproject.com/ticket/20036