code: func TakeMessage(reader io.Reader, count int, f func([]byte) error) (err error) {
  	if _, isBufioReader := reader.(*bufio.Reader); !isBufioReader {
  		reader = bufio.NewReader(reader)
  	}
  	for err == nil {
  		if count == 0 {
  			io.Copy(ioutil.Discard, reader)
  			return nil
  		}
  		message, readError := ReadMessage(reader)
  		if readError == io.EOF {
  			break
  		}
  		if readError == nil {
  			err = f(message)
  		} else {
  			return fmt.Errorf("Failed to read message: %v\n", readError)
  		}
  		count--
  	}
  
  	return
  }
docs: // TakeMessage Reads and processes MessagePack encoded messages.
  // If count is less than 0, all lines are processed.