docs: def StartExecServer():
    """Opens a socket in /tmp, execs data from it and writes results back."""
    sockdir = '/tmp/pyringe_%s' % os.getpid()
    if not os.path.isdir(sockdir):
      os.mkdir(sockdir)
    socket_path = ('%s/%s.execsock' %
                   (sockdir, threading.current_thread().ident))
  
    if os.path.exists(socket_path):
      os.remove(socket_path)
  
    exec_sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
    exec_sock.bind(socket_path)
    exec_sock.listen(5)
    shutdown = False
    while not shutdown:
      conn, _ = exec_sock.accept()
  
      data = conn.recv(1024)
      if data:
        if data == '__kill__':
          shutdown = True
          conn.send('__kill_ack__')
          break
        data = json.loads(data)
        try:
          conn.sendall(json.dumps(eval(data)))
        except SyntaxError:
          # Okay, so it probably wasn't an expression
          try:
            exec data  # pylint: disable=exec-used
          except:  # pylint: disable=bare-except
            # Whatever goes wrong when exec'ing this, we don't want to crash.
            # TODO: think of a way to properly tunnel exceptions, if
            # possible without introducing more magic strings.
            pass
          finally:
            conn.sendall(json.dumps(None))
    exec_sock.shutdown(socket.SHUT_RDWR)
    exec_sock.close()
    os.remove(socket_path)