code: def dbcmd(action, *args):
      
      global sock
      if sock is None:
          sock = zeromq.Socket(
              'tcp://%s:%s' % (config.dbserver.host, DBSERVER_PORT),
              zeromq.zmq.REQ, 'connect').__enter__()
          # the socket will be closed when the calculation ends
      res = sock.send((action,) + args)
      if isinstance(res, parallel.Result):
          return res.get()
      return res
docs: A dispatcher to the database server.
  
      :param action: database action to perform
      :param args: arguments