def patch(): global is_patched if is_patched or os.environ.get('RILL_SKIP_GEVENT_PATCH', False): return from gevent import monkey print("Performing gevent monkey-patching") monkey.patch_all() is_patched = True