code: def send(self, request):
          
          self._logger.debug('Opening connection')
          sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
          sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
          sock.connect((self._host, self._port))
          talk = SocketTalk(sock, encode=self._encode)
  
          self._logger.debug('Sending action %s' % request.action)
          if not talk.put(request.action):
              self._logger.error('Failed to send action %s' % request.action)
              return None
  
          if request.key is not None:
              self._logger.debug('Sending key %s' % request.key)
              if not talk.put(request.key):
                  self._logger.error('Failed to send key %s' % request.key)
                  return None
  
          if request.value is not None:
              self._logger.debug('Sending value')
              if not talk.put(request.value):
                  self._logger.error('Failed to send value')
                  return None
  
          self._logger.debug('Receiving status')
          response = talk.get()
          if not response:
              self._logger.error('Failed to receive status')
              return None
          self._logger.debug('Status response = %s' % response)
  
          if request.action in ('get', 'size', 'keys') and response == 'ok':
              self._logger.debug('Receiving value')
              response = talk.get()
              if not response:
                  self._logger.error('Failed to receive value')
                  return None
  
          if request.action in ('keys',):
              response = pickle.loads(response)
  
          self._logger.debug('Closing connection')
          try:
              sock.shutdown(socket.SHUT_RDWR)
          except:
              self._logger.error('Failed to shutdown')
          sock.close()
  
          return response
docs: Send request to server and return server response.