docs: def send(self, cmd, *payload):
          """
          Send a command message to the other end.
  
          :param cmd: The command to send to the other end.
          :param payload: The command payload.  Note that all elements
                          of the payload must be serializable to JSON.
          """
  
          # If it's closed, raise an error up front
          if not self._sock:
              raise ConnectionClosed("Connection closed")
  
          # Construct the outgoing message
          msg = json.dumps(dict(cmd=cmd, payload=payload)) + '\n'
  
          # Send it
          try:
              self._sock.sendall(msg)
          except socket.error:
              # We'll need to re-raise
              e_type, e_value, e_tb = sys.exc_info()
  
              # Make sure the socket is closed
              self.close()
  
              # Re-raise
              raise e_type, e_value, e_tb