Better workaround for PY-12317