code: func newCallback(receiver, fn reflect.Value) *callback {
  	fntype := fn.Type()
  	c := &callback{fn: fn, rcvr: receiver, errPos: -1, isSubscribe: isPubSub(fntype)}
  	// Determine parameter types. They must all be exported or builtin types.
  	c.makeArgTypes()
  	if !allExportedOrBuiltin(c.argTypes) {
  		return nil
  	}
  	// Verify return types. The function must return at most one error
  	// and/or one other non-error value.
  	outs := make([]reflect.Type, fntype.NumOut())
  	for i := 0; i < fntype.NumOut(); i++ {
  		outs[i] = fntype.Out(i)
  	}
  	if len(outs) > 2 || !allExportedOrBuiltin(outs) {
  		return nil
  	}
  	// If an error is returned, it must be the last returned value.
  	switch {
  	case len(outs) == 1 && isErrorType(outs[0]):
  		c.errPos = 0
  	case len(outs) == 2:
  		if isErrorType(outs[0]) || !isErrorType(outs[1]) {
  			return nil
  		}
  		c.errPos = 1
  	}
  	return c
  }
docs: // newCallback turns fn (a function) into a callback object. It returns nil if the function
  // is unsuitable as an RPC callback.