code: func (c *Client) marshalAndSend(method interface{}, arguments []interface{}) (callbacks map[string]dnode.Path, errC <-chan error, err error) {
  	// scrub trough the arguments and save any callbacks.
  	callbacks = c.scrubber.Scrub(arguments)
  
  	defer func() {
  		if err != nil {
  			c.removeCallbacks(callbacks)
  		}
  	}()
  
  	// Do not encode empty arguments as "null", make it "[]".
  	if arguments == nil {
  		arguments = make([]interface{}, 0)
  	}
  
  	rawArgs, err := json.Marshal(arguments)
  	if err != nil {
  		return nil, nil, err
  	}
  
  	msg := dnode.Message{
  		Method:    method,
  		Arguments: &dnode.Partial{Raw: rawArgs},
  		Callbacks: callbacks,
  	}
  
  	p, err := json.Marshal(msg)
  	if err != nil {
  		return nil, nil, err
  	}
  
  	select {
  	case <-c.closeChan:
  		return nil, nil, errors.New("can't send, client is closed")
  	default:
  		if c.getSession() == nil {
  			return nil, nil, errors.New("can't send, session is not established yet")
  		}
  
  		errC := make(chan error, 1)
  
  		c.send <- &message{
  			p:    p,
  			errC: errC,
  		}
  
  		return callbacks, errC, nil
  	}
  }
docs: // marshalAndSend takes a method and arguments, scrubs the arguments to create
  // a dnode message, marshals the message to JSON and sends it over the wire.