def _child(target, args, kwargs):
   """Wrapper function that runs in child process. Resets gevent/libev state
   and executes user-given function.
   """
   _tryGevent()
   _reset_signal_handlers()
   gevent.reinit()
   hub = gevent.get_hub()
   del hub.threadpool
   hub._threadpool = None
   hub.destroy(destroy_loop=True)
   h = gevent.get_hub(default=True)
   assert h.loop.default, 'Could not create libev default event loop.'
   target(*args, **kwargs)